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.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 Summary
ConstructorsConstructorDescriptionByteBufferOptimizedBinaryDecoder(byte[] data) ByteBufferOptimizedBinaryDecoder(byte[] data, int offset, int length) -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanisEnd()longmapNext()longbooleanreadBytes(ByteBuffer old) doubleintreadEnum()voidreadFixed(byte[] bytes, int start, int length) floatintintreadInt()longreadLong()longvoidreadNull()org.apache.avro.util.Utf8readString(org.apache.avro.util.Utf8 old) longvoidvoidskipFixed(int length) longskipMap()voidMethods inherited from class org.apache.avro.io.BinaryDecoder
doReadBytes, doReadItemCount, doSkipBytesMethods inherited from class org.apache.avro.io.Decoder
readFixed
-
Constructor Details
-
ByteBufferOptimizedBinaryDecoder
public ByteBufferOptimizedBinaryDecoder(byte[] data) -
ByteBufferOptimizedBinaryDecoder
public ByteBufferOptimizedBinaryDecoder(byte[] data, int offset, int length)
-
-
Method Details
-
readString
- Overrides:
readStringin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readNull
- Overrides:
readNullin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readBoolean
- Overrides:
readBooleanin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readInt
- Overrides:
readIntin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readLong
- Overrides:
readLongin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readFloat
- Overrides:
readFloatin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readDouble
- Overrides:
readDoublein classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readString
- Overrides:
readStringin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
skipString
- Overrides:
skipStringin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readBytes
- Overrides:
readBytesin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
skipBytes
- Overrides:
skipBytesin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readFixed
- Overrides:
readFixedin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
skipFixed
- Overrides:
skipFixedin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readEnum
- Overrides:
readEnumin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readArrayStart
- Overrides:
readArrayStartin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
arrayNext
- Overrides:
arrayNextin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
skipArray
- Overrides:
skipArrayin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readMapStart
- Overrides:
readMapStartin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
mapNext
- Overrides:
mapNextin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
skipMap
- Overrides:
skipMapin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
readIndex
- Overrides:
readIndexin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
isEnd
- Overrides:
isEndin classorg.apache.avro.io.BinaryDecoder- Throws:
IOException
-
inputStream
- Overrides:
inputStreamin classorg.apache.avro.io.BinaryDecoder
-