Interface StreamDecoderInput
- All Superinterfaces:
AutoCloseable
,SafeCloseable
An input of
StreamDecoder
which is used to read a stream of objects.-
Method Summary
Modifier and TypeMethodDescriptionbyte
getByte
(int index) Returns a byte at the specified absoluteindex
in thisStreamDecoderInput
.default boolean
Returns whether this input contains any readable bytes.int
Returns the number of readable bytes.byte
readByte()
Reads a byte from the readable bytes.void
readBytes
(byte[] dst) Reads data to the specifieddst
.readBytes
(int length) Reads a newly retained slice of thisByteBuf
from the readable bytes.int
readInt()
Reads a 32-bit integer from the readable bytes.long
readLong()
Reads a 64-bit long from the readable bytes.default short
Reads an unsigned byte from the readable bytes.default int
Reads an unsigned short from the readable bytes.void
skipBytes
(int length) Skips bytes of the specifiedlength
in thisStreamDecoderInput
.Methods inherited from interface com.linecorp.armeria.common.util.SafeCloseable
close
-
Method Details
-
readableBytes
int readableBytes()Returns the number of readable bytes. -
isReadable
default boolean isReadable()Returns whether this input contains any readable bytes. -
readByte
byte readByte()Reads a byte from the readable bytes. -
readUnsignedByte
default short readUnsignedByte()Reads an unsigned byte from the readable bytes. -
readUnsignedShort
default int readUnsignedShort()Reads an unsigned short from the readable bytes.- Throws:
IllegalStateException
- if thereadableBytes()
is less than2
bytes.
-
readInt
int readInt()Reads a 32-bit integer from the readable bytes.- Throws:
IllegalStateException
- if thereadableBytes()
is less than4
bytes.
-
readLong
long readLong()Reads a 64-bit long from the readable bytes.- Throws:
IllegalStateException
- if thereadableBytes()
is less than8
bytes.
-
readBytes
Reads a newly retained slice of thisByteBuf
from the readable bytes.- Throws:
IllegalStateException
- if the specifiedlength
is greater thanreadableBytes()
-
readBytes
void readBytes(byte[] dst) Reads data to the specifieddst
.- Throws:
IllegalStateException
- if the length of thedst
is greater thanreadableBytes()
-
getByte
byte getByte(int index) Returns a byte at the specified absoluteindex
in thisStreamDecoderInput
.- Throws:
IllegalStateException
- if the specifiedindex
is greater thanreadableBytes()
-
skipBytes
void skipBytes(int length) Skips bytes of the specifiedlength
in thisStreamDecoderInput
.- Throws:
IllegalStateException
- if the specifiedlength
is greater thanreadableBytes()
-