Class TagReaderImpl.InputStreamDecoder
java.lang.Object
org.infinispan.protostream.impl.TagReaderImpl.Decoder
org.infinispan.protostream.impl.TagReaderImpl.InputStreamDecoder
- Enclosing class:
TagReaderImpl
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InputStreamprivate intAbsolute position (from start of input data) of the last byte we are allowed to read by last pushLimit.private intCurrent position.Fields inherited from class TagReaderImpl.Decoder
globalLimit, lastTag -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) byte[](package private) intgetEnd()(package private) InputStream(package private) intgetPos()(package private) booleanisAtEnd()private booleanprivate boolean(package private) voidpopLimit(int oldLimit) (package private) intpushLimit(int limit) (package private) int(package private) long(package private) byte(package private) byte[]readRawByteArray(int length) (package private) ByteBufferreadRawByteBuffer(int length) (package private) String(package private) long(package private) intsetGlobalLimit(int globalLimit) Sets a hard limit on how many bytes we can continue to read while parsing a message from current position.private voidskipNBytes(long n) protected voidskipRawBytes(int length) protected voidMethods inherited from class TagReaderImpl.Decoder
checkLastTagWas, readTag, readVarint32, skipField
-
Field Details
-
in
-
pos
private int posCurrent position. -
limit
private int limitAbsolute position (from start of input data) of the last byte we are allowed to read by last pushLimit.
-
-
Constructor Details
-
InputStreamDecoder
-
-
Method Details
-
readString
- Specified by:
readStringin classTagReaderImpl.Decoder- Throws:
IOException
-
readRawByteBuffer
- Specified by:
readRawByteBufferin classTagReaderImpl.Decoder- Throws:
IOException
-
skipVarint
- Specified by:
skipVarintin classTagReaderImpl.Decoder- Throws:
IOException
-
readVarint64
- Specified by:
readVarint64in classTagReaderImpl.Decoder- Throws:
IOException
-
readFixed32
- Specified by:
readFixed32in classTagReaderImpl.Decoder- Throws:
IOException
-
readFixed64
- Specified by:
readFixed64in classTagReaderImpl.Decoder- Throws:
IOException
-
setGlobalLimit
int setGlobalLimit(int globalLimit) Description copied from class:TagReaderImpl.DecoderSets 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.- Specified by:
setGlobalLimitin classTagReaderImpl.Decoder
-
pushLimit
- Specified by:
pushLimitin classTagReaderImpl.Decoder- Throws:
IOException
-
popLimit
void popLimit(int oldLimit) - Specified by:
popLimitin classTagReaderImpl.Decoder
-
getEnd
int getEnd()- Specified by:
getEndin classTagReaderImpl.Decoder
-
getPos
int getPos()- Specified by:
getPosin classTagReaderImpl.Decoder
-
getBufferArray
- Specified by:
getBufferArrayin classTagReaderImpl.Decoder- Throws:
IOException
-
getInputStream
InputStream getInputStream() -
isAtEnd
- Specified by:
isAtEndin classTagReaderImpl.Decoder- Throws:
IOException
-
isPushbackDone
- Throws:
IOException
-
isMarkDone
- Throws:
IOException
-
readRawByte
- Specified by:
readRawBytein classTagReaderImpl.Decoder- Throws:
IOException
-
readRawByteArray
- Specified by:
readRawByteArrayin classTagReaderImpl.Decoder- Throws:
IOException
-
skipRawBytes
- Specified by:
skipRawBytesin classTagReaderImpl.Decoder- Throws:
IOException
-
skipNBytes
- Throws:
IOException
-