Package org.apache.avro.io
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.BinaryDecoderThis class is a wrapper ofBinaryDecoderwith the following optimization: When deserializing byte array field, instead of copying the bytes into a newByteBuffer, 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 Summary
Constructors Constructor Description ByteBufferOptimizedBinaryDecoder(byte[] data)ByteBufferOptimizedBinaryDecoder(byte[] data, int offset, int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longarrayNext()java.io.InputStreaminputStream()booleanisEnd()longmapNext()longreadArrayStart()booleanreadBoolean()java.nio.ByteBufferreadBytes(java.nio.ByteBuffer old)doublereadDouble()intreadEnum()voidreadFixed(byte[] bytes, int start, int length)floatreadFloat()intreadIndex()intreadInt()longreadLong()longreadMapStart()voidreadNull()java.lang.StringreadString()org.apache.avro.util.Utf8readString(org.apache.avro.util.Utf8 old)longskipArray()voidskipBytes()voidskipFixed(int length)longskipMap()voidskipString()
-
-
-
Method Detail
-
readString
public java.lang.String readString() throws java.io.IOException- Overrides:
readStringin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readNull
public void readNull() throws java.io.IOException- Overrides:
readNullin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readBoolean
public boolean readBoolean() throws java.io.IOException- Overrides:
readBooleanin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readInt
public int readInt() throws java.io.IOException- Overrides:
readIntin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readLong
public long readLong() throws java.io.IOException- Overrides:
readLongin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readFloat
public float readFloat() throws java.io.IOException- Overrides:
readFloatin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readDouble
public double readDouble() throws java.io.IOException- Overrides:
readDoublein classorg.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:
readStringin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
skipString
public void skipString() throws java.io.IOException- Overrides:
skipStringin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readBytes
public java.nio.ByteBuffer readBytes(java.nio.ByteBuffer old) throws java.io.IOException- Overrides:
readBytesin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
skipBytes
public void skipBytes() throws java.io.IOException- Overrides:
skipBytesin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readFixed
public void readFixed(byte[] bytes, int start, int length) throws java.io.IOException- Overrides:
readFixedin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
skipFixed
public void skipFixed(int length) throws java.io.IOException- Overrides:
skipFixedin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readEnum
public int readEnum() throws java.io.IOException- Overrides:
readEnumin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readArrayStart
public long readArrayStart() throws java.io.IOException- Overrides:
readArrayStartin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
arrayNext
public long arrayNext() throws java.io.IOException- Overrides:
arrayNextin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
skipArray
public long skipArray() throws java.io.IOException- Overrides:
skipArrayin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readMapStart
public long readMapStart() throws java.io.IOException- Overrides:
readMapStartin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
mapNext
public long mapNext() throws java.io.IOException- Overrides:
mapNextin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
skipMap
public long skipMap() throws java.io.IOException- Overrides:
skipMapin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
readIndex
public int readIndex() throws java.io.IOException- Overrides:
readIndexin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
isEnd
public boolean isEnd() throws java.io.IOException- Overrides:
isEndin classorg.apache.avro.io.BinaryDecoder- Throws:
java.io.IOException
-
inputStream
public java.io.InputStream inputStream()
- Overrides:
inputStreamin classorg.apache.avro.io.BinaryDecoder
-
-