Package org.infinispan.protostream
Interface Decoder
-
- All Known Implementing Classes:
TagReaderImpl.DecoderImpl
public interface Decoder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
checkLastTagWas(int expectedTag)
Decoder
decoderFromLength(int length)
byte[]
getBufferArray()
int
getEnd()
int
getPos()
boolean
isAtEnd()
void
popLimit(int oldLimit)
int
pushLimit(int newLimit)
int
readFixed32()
long
readFixed64()
byte
readRawByte()
byte[]
readRawByteArray(int length)
ByteBuffer
readRawByteBuffer(int length)
String
readString()
int
readTag()
int
readVarint32()
long
readVarint64()
int
setGlobalLimit(int globalLimit)
Sets a hard limit on how many bytes we can continue to read while parsing a message from current position.boolean
skipField(int tag)
void
skipRawBytes(int length)
void
skipVarint()
-
-
-
Method Detail
-
getEnd
int getEnd()
-
getPos
int getPos()
-
getBufferArray
byte[] getBufferArray() throws IOException
- Throws:
IOException
-
isAtEnd
boolean isAtEnd() throws IOException
- Throws:
IOException
-
readTag
int readTag() throws IOException
- Throws:
IOException
-
checkLastTagWas
void checkLastTagWas(int expectedTag) throws IOException
- Throws:
IOException
-
skipField
boolean skipField(int tag) throws IOException
- Throws:
IOException
-
skipVarint
void skipVarint() throws IOException
- Throws:
IOException
-
skipRawBytes
void skipRawBytes(int length) throws IOException
- Throws:
IOException
-
readString
String readString() throws IOException
- Throws:
IOException
-
readRawByte
byte readRawByte() throws IOException
- Throws:
IOException
-
readRawByteArray
byte[] readRawByteArray(int length) throws IOException
- Throws:
IOException
-
readRawByteBuffer
ByteBuffer readRawByteBuffer(int length) throws IOException
- Throws:
IOException
-
readVarint32
int readVarint32() throws IOException
- Throws:
IOException
-
readVarint64
long readVarint64() throws IOException
- Throws:
IOException
-
readFixed32
int readFixed32() throws IOException
- Throws:
IOException
-
readFixed64
long readFixed64() throws IOException
- Throws:
IOException
-
pushLimit
int pushLimit(int newLimit) throws IOException
- Throws:
IOException
-
popLimit
void popLimit(int oldLimit)
-
decoderFromLength
Decoder decoderFromLength(int length) throws IOException
- Throws:
IOException
-
setGlobalLimit
int setGlobalLimit(int globalLimit)
Sets a hard limit on how many bytes we can continue to read while parsing a message from current position. This is useful to prevent corrupted or malicious messages with wrong length values to abuse memory allocation. Initially this limit is set toInteger.MAX_INT
, which means the protection mechanism is disabled by default. The limit is only useful when processing streams. Setting a limit for a decoder backed by a byte array is useless because the memory allocation already happened.
-
-