public interface BufferInput<T extends BufferInput<?>> extends AutoCloseable
This interface exposes methods for reading from a byte buffer. Readable buffers maintain a small amount of state
regarding current cursor positions and limits similar to the behavior of ByteBuffer.
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
hasRemaining()
Returns a boolean value indicating whether the input has bytes remaining.
|
T |
read(Buffer buffer)
Reads bytes into the given buffer.
|
T |
read(byte[] bytes)
Reads bytes into the given byte array.
|
T |
read(byte[] bytes,
long offset,
long length)
Reads bytes into the given byte array starting at current position up to the given length.
|
T |
read(Bytes bytes)
Reads bytes into the given byte array.
|
T |
read(Bytes bytes,
long offset,
long length)
Reads bytes into the given byte array starting at the current position.
|
boolean |
readBoolean()
Reads a 1 byte boolean from the buffer at the current position.
|
int |
readByte()
Reads a byte from the buffer at the current position.
|
char |
readChar()
Reads a 16-bit character from the buffer at the current position.
|
double |
readDouble()
Reads a double-precision 64-bit floating point number from the buffer at the current position.
|
float |
readFloat()
Reads a single-precision 32-bit floating point number from the buffer at the current position.
|
int |
readInt()
Reads a 32-bit signed integer from the buffer at the current position.
|
long |
readLong()
Reads a 64-bit signed integer from the buffer at the current position.
|
int |
readMedium()
Reads a 24-bit signed integer from the buffer at the current position.
|
short |
readShort()
Reads a 16-bit signed integer from the buffer at the current position.
|
String |
readString()
Reads a string from the buffer at the current position.
|
int |
readUnsignedByte()
Reads an unsigned byte from the buffer at the current position.
|
long |
readUnsignedInt()
Reads a 32-bit unsigned integer from the buffer at the current position.
|
int |
readUnsignedMedium()
Reads a 24-bit unsigned integer from the buffer at the current position.
|
int |
readUnsignedShort()
Reads a 16-bit unsigned integer from the buffer at the current position.
|
String |
readUTF8()
Reads a UTF-8 string from the buffer at the current position.
|
long |
remaining()
Returns the number of bytes remaining in the input.
|
T |
skip(long bytes)
Skips the given number of bytes in the input.
|
long remaining()
boolean hasRemaining()
T skip(long bytes)
bytes - The number of bytes to attempt to skip.T read(Bytes bytes)
bytes - The byte array into which to read bytes.T read(byte[] bytes)
bytes - The byte array into which to read bytes.T read(Bytes bytes, long offset, long length)
bytes - The byte array into which to read bytes.offset - The offset at which to write bytes into the given bufferT read(byte[] bytes, long offset, long length)
bytes - The byte array into which to read bytes.offset - The offset at which to write bytes into the given bufferT read(Buffer buffer)
buffer - The buffer into which to read bytes.int readByte()
int readUnsignedByte()
char readChar()
short readShort()
int readUnsignedShort()
int readMedium()
int readUnsignedMedium()
int readInt()
long readUnsignedInt()
long readLong()
float readFloat()
double readDouble()
boolean readBoolean()
String readString()
String readUTF8()
void close()
close in interface AutoCloseableCopyright © 2013–2015. All rights reserved.