Class ByteBufferOptimizedBinaryDecoder


  • public class ByteBufferOptimizedBinaryDecoder
    extends org.apache.avro.io.BinaryDecoder
    This class is a wrapper of BinaryDecoder with the following optimization: When deserializing byte array field, instead of copying the bytes into a new ByteBuffer, this class will create a ByteBuffer, which is wrapping the original array. This optimization is useful when we know that the original array won't change during the lifecycle. This optimization should work with both 1.4 and 1.7.
    • Constructor Detail

      • ByteBufferOptimizedBinaryDecoder

        public ByteBufferOptimizedBinaryDecoder​(byte[] data)
      • ByteBufferOptimizedBinaryDecoder

        public ByteBufferOptimizedBinaryDecoder​(byte[] data,
                                                int offset,
                                                int length)
    • Method Detail

      • readString

        public java.lang.String readString()
                                    throws java.io.IOException
        Overrides:
        readString in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readNull

        public void readNull()
                      throws java.io.IOException
        Overrides:
        readNull in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readBoolean

        public boolean readBoolean()
                            throws java.io.IOException
        Overrides:
        readBoolean in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Overrides:
        readInt in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Overrides:
        readLong in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Overrides:
        readFloat in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readDouble

        public double readDouble()
                          throws java.io.IOException
        Overrides:
        readDouble in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readString

        public org.apache.avro.util.Utf8 readString​(org.apache.avro.util.Utf8 old)
                                             throws java.io.IOException
        Overrides:
        readString in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • skipString

        public void skipString()
                        throws java.io.IOException
        Overrides:
        skipString in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readBytes

        public java.nio.ByteBuffer readBytes​(java.nio.ByteBuffer old)
                                      throws java.io.IOException
        Overrides:
        readBytes in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • skipBytes

        public void skipBytes()
                       throws java.io.IOException
        Overrides:
        skipBytes in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readFixed

        public void readFixed​(byte[] bytes,
                              int start,
                              int length)
                       throws java.io.IOException
        Overrides:
        readFixed in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • skipFixed

        public void skipFixed​(int length)
                       throws java.io.IOException
        Overrides:
        skipFixed in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readEnum

        public int readEnum()
                     throws java.io.IOException
        Overrides:
        readEnum in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readArrayStart

        public long readArrayStart()
                            throws java.io.IOException
        Overrides:
        readArrayStart in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • arrayNext

        public long arrayNext()
                       throws java.io.IOException
        Overrides:
        arrayNext in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • skipArray

        public long skipArray()
                       throws java.io.IOException
        Overrides:
        skipArray in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readMapStart

        public long readMapStart()
                          throws java.io.IOException
        Overrides:
        readMapStart in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • mapNext

        public long mapNext()
                     throws java.io.IOException
        Overrides:
        mapNext in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • skipMap

        public long skipMap()
                     throws java.io.IOException
        Overrides:
        skipMap in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • readIndex

        public int readIndex()
                      throws java.io.IOException
        Overrides:
        readIndex in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • isEnd

        public boolean isEnd()
                      throws java.io.IOException
        Overrides:
        isEnd in class org.apache.avro.io.BinaryDecoder
        Throws:
        java.io.IOException
      • inputStream

        public java.io.InputStream inputStream()
        Overrides:
        inputStream in class org.apache.avro.io.BinaryDecoder