public class ByteBufInputStream extends InputStream implements DataInput
InputStream which reads data from a ByteBuf.
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.
Implement copy from netty io.netty.buffer.ByteBufInputStream,
The ByteBuf implementation is replaced with cobble.bytebufByteBufOutputStream| 构造器和说明 |
|---|
ByteBufInputStream(ByteBuf buffer)
Creates a new stream which reads data from the specified
buffer
starting at the current readerIndex and ending at the current
writerIndex. |
ByteBufInputStream(ByteBuf buffer,
boolean releaseOnClose)
Creates a new stream which reads data from the specified
buffer
starting at the current readerIndex and ending at the current
writerIndex. |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
available() |
void |
close() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
boolean |
readBoolean() |
byte |
readByte() |
int |
readBytes()
Returns the number of read bytes by this stream so far.
|
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
String |
readLine() |
String |
readLine(Charset charset) |
long |
readLong() |
int |
readMedium() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
String |
readUTF() |
void |
reset() |
long |
skip(long n) |
int |
skipBytes(int n) |
readpublic ByteBufInputStream(ByteBuf buffer)
buffer
starting at the current readerIndex and ending at the current
writerIndex.buffer - The buffer which provides the content for this InputStream.public ByteBufInputStream(ByteBuf buffer, boolean releaseOnClose)
buffer
starting at the current readerIndex and ending at the current
writerIndex.buffer - The buffer which provides the content for this InputStream.releaseOnClose - true means that when close() is called then ByteBuf.free() will
be called on buffer.public int readBytes()
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 InputStreamIOExceptionpublic void mark(int readlimit)
mark 在类中 InputStreampublic boolean markSupported()
markSupported 在类中 InputStreampublic void reset()
throws IOException
reset 在类中 InputStreamIOExceptionpublic int available()
available 在类中 InputStreampublic int read()
throws IOException
read 在类中 InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read 在类中 InputStreamIOExceptionpublic long skip(long n)
skip 在类中 InputStreampublic boolean readBoolean()
throws IOException
readBoolean 在接口中 DataInputIOExceptionpublic byte readByte()
throws IOException
readByte 在接口中 DataInputIOExceptionpublic double readDouble()
readDouble 在接口中 DataInputpublic int readMedium()
public String readUTF() throws IOException
readUTF 在接口中 DataInputIOExceptionpublic int readUnsignedByte()
readUnsignedByte 在接口中 DataInputpublic int readUnsignedShort()
readUnsignedShort 在接口中 DataInputCopyright © 2022–2024. All rights reserved.