Package org.jboss.netty.buffer
Class ChannelBufferInputStream
java.lang.Object
java.io.InputStream
org.jboss.netty.buffer.ChannelBufferInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable
An
InputStream which reads data from a ChannelBuffer.
A read operation against this stream will occur at the readerIndex
of its underlying buffer and the readerIndex will increase during
the read operation.
This stream implements DataInput for your convenience.
The endianness of the stream is not always big endian but depends on
the endianness of the underlying buffer.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelBufferprivate final intprivate final StringBuilderprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new stream which reads data from the specifiedbufferstarting at the currentreaderIndexand ending at the currentwriterIndex.ChannelBufferInputStream(ChannelBuffer buffer, int length) Creates a new stream which reads data from the specifiedbufferstarting at the currentreaderIndexand ending atreaderIndex + length. -
Method Summary
Modifier and TypeMethodDescriptionintprivate voidcheckAvailable(int fieldSize) voidmark(int readlimit) booleanintread()intread(byte[] b, int off, int len) booleanbytereadByte()intReturns the number of read bytes by this stream so far.charreadChar()doublefloatvoidreadFully(byte[] b) voidreadFully(byte[] b, int off, int len) intreadInt()readLine()longreadLong()shortintintreadUTF()voidreset()longskip(long n) intskipBytes(int n) Methods inherited from class java.io.InputStream
close, read
-
Field Details
-
buffer
-
startIndex
private final int startIndex -
endIndex
private final int endIndex -
lineBuf
-
-
Constructor Details
-
ChannelBufferInputStream
Creates a new stream which reads data from the specifiedbufferstarting at the currentreaderIndexand ending at the currentwriterIndex. -
ChannelBufferInputStream
Creates a new stream which reads data from the specifiedbufferstarting at the currentreaderIndexand ending atreaderIndex + length.- Throws:
IndexOutOfBoundsException- ifreaderIndex + lengthis greater thanwriterIndex
-
-
Method Details
-
readBytes
public int readBytes()Returns the number of read bytes by this stream so far. -
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceDataInput- Throws:
IOException
-
checkAvailable
- Throws:
IOException
-