Class ByteBufferOptimizedBinaryDecoder

java.lang.Object
org.apache.avro.io.Decoder
org.apache.avro.io.BinaryDecoder
org.apache.avro.io.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 Details

    • ByteBufferOptimizedBinaryDecoder

      public ByteBufferOptimizedBinaryDecoder(byte[] data)
    • ByteBufferOptimizedBinaryDecoder

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

    • readString

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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