Class TagReaderImpl.Decoder

java.lang.Object
org.infinispan.protostream.impl.TagReaderImpl.Decoder
Direct Known Subclasses:
TagReaderImpl.ByteArrayDecoder, TagReaderImpl.ByteBufferDecoder, TagReaderImpl.InputStreamDecoder
Enclosing class:
TagReaderImpl

private abstract static class TagReaderImpl.Decoder extends Object
Since:
3.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    checkLastTagWas(int expectedTag)
     
    (package private) abstract byte[]
     
    (package private) abstract int
     
    (package private) abstract int
     
    (package private) abstract boolean
     
    (package private) abstract void
    popLimit(int oldLimit)
     
    (package private) abstract int
    pushLimit(int newLimit)
     
    (package private) abstract int
     
    (package private) abstract long
     
    (package private) abstract byte
     
    (package private) abstract byte[]
    readRawByteArray(int length)
     
    (package private) abstract ByteBuffer
    readRawByteBuffer(int length)
     
    (package private) abstract String
     
    (package private) final int
     
    (package private) final int
    Reads a Varint (possibly 64 bits wide) and silently discards the upper bits if larger than 32 bits.
    (package private) abstract long
     
    (package private) abstract int
    setGlobalLimit(int globalLimit)
    Sets a hard limit on how many bytes we can continue to read while parsing a message from current position.
    (package private) final boolean
    skipField(int tag)
     
    (package private) abstract void
    skipRawBytes(int length)
     
    (package private) abstract void
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • globalLimit

      protected int globalLimit
    • lastTag

      protected int lastTag
  • Constructor Details

    • Decoder

      private Decoder()
  • Method Details

    • getEnd

      abstract int getEnd()
    • getPos

      abstract int getPos()
    • getBufferArray

      abstract byte[] getBufferArray() throws IOException
      Throws:
      IOException
    • isAtEnd

      abstract boolean isAtEnd() throws IOException
      Throws:
      IOException
    • readTag

      final int readTag() throws IOException
      Throws:
      IOException
    • checkLastTagWas

      final void checkLastTagWas(int expectedTag) throws IOException
      Throws:
      IOException
    • skipField

      final boolean skipField(int tag) throws IOException
      Throws:
      IOException
    • skipVarint

      abstract void skipVarint() throws IOException
      Throws:
      IOException
    • skipRawBytes

      abstract void skipRawBytes(int length) throws IOException
      Throws:
      IOException
    • readString

      abstract String readString() throws IOException
      Throws:
      IOException
    • readRawByte

      abstract byte readRawByte() throws IOException
      Throws:
      IOException
    • readRawByteArray

      abstract byte[] readRawByteArray(int length) throws IOException
      Throws:
      IOException
    • readRawByteBuffer

      abstract ByteBuffer readRawByteBuffer(int length) throws IOException
      Throws:
      IOException
    • readVarint32

      final int readVarint32() throws IOException
      Reads a Varint (possibly 64 bits wide) and silently discards the upper bits if larger than 32 bits.
      Throws:
      IOException
    • readVarint64

      abstract long readVarint64() throws IOException
      Throws:
      IOException
    • readFixed32

      abstract int readFixed32() throws IOException
      Throws:
      IOException
    • readFixed64

      abstract long readFixed64() throws IOException
      Throws:
      IOException
    • pushLimit

      abstract int pushLimit(int newLimit) throws IOException
      Throws:
      IOException
    • popLimit

      abstract void popLimit(int oldLimit)
    • setGlobalLimit

      abstract 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 to Integer.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.