Package org.infinispan.protostream.impl
Class TagReaderImpl.ByteArrayDecoder
java.lang.Object
org.infinispan.protostream.impl.TagReaderImpl.Decoder
org.infinispan.protostream.impl.TagReaderImpl.ByteArrayDecoder
- Enclosing class:
TagReaderImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private intprivate intprivate intprivate final intprivate final intFields inherited from class org.infinispan.protostream.impl.TagReaderImpl.Decoder
globalLimit, lastTag -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void(package private) byte[](package private) intgetEnd()(package private) intgetPos()(package private) booleanisAtEnd()(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.protected voidskipRawBytes(int length) protected voidMethods inherited from class org.infinispan.protostream.impl.TagReaderImpl.Decoder
checkLastTagWas, readTag, readVarint32, skipField
-
Field Details
-
array
private final byte[] array -
start
private final int start -
stop
private final int stop -
pos
private int pos -
end
private int end -
limit
private int limit
-
-
Constructor Details
-
ByteArrayDecoder
private ByteArrayDecoder(byte[] array, int offset, int length)
-
-
Method Details
-
pushLimit
- Specified by:
pushLimitin classTagReaderImpl.Decoder- Throws:
IOException
-
popLimit
void popLimit(int oldLimit) - Specified by:
popLimitin classTagReaderImpl.Decoder
-
adjustEnd
private void adjustEnd() -
getEnd
int getEnd()- Specified by:
getEndin classTagReaderImpl.Decoder
-
getPos
int getPos()- Specified by:
getPosin classTagReaderImpl.Decoder
-
getBufferArray
- Specified by:
getBufferArrayin classTagReaderImpl.Decoder- Throws:
IOException
-
isAtEnd
boolean isAtEnd()- Specified by:
isAtEndin classTagReaderImpl.Decoder
-
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
-
readRawByte
- Specified by:
readRawBytein classTagReaderImpl.Decoder- Throws:
IOException
-
readRawByteArray
- Specified by:
readRawByteArrayin classTagReaderImpl.Decoder- Throws:
IOException
-
skipRawBytes
- Specified by:
skipRawBytesin 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
-