Package com.google.protobuf
Class IterableByteBufferInputStream
java.lang.Object
java.io.InputStream
com.google.protobuf.IterableByteBufferInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
If the current ByteBuffer is unsafe-direct based, currentAddress is the start address of this ByteBuffer; otherwise should be zero.private byte[]
If the current ByteBuffer is unsafe-direct based, currentArray is null; otherwise should be the array inside ByteBuffer.private int
Current ByteBuffer's array offsetprivate ByteBuffer
The current ByteBuffer;private int
The current position for current ByteBufferprivate int
CurrentByteBuffer
's indexprivate int
The number of ByteBuffers in the input data.private boolean
Whether current ByteBuffer has an arrayprivate Iterator
<ByteBuffer> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
int
read()
int
read
(byte[] output, int offset, int length) private void
updateCurrentByteBufferPos
(int numberOfBytesRead) Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
iterator
-
currentByteBuffer
The current ByteBuffer; -
dataSize
private int dataSizeThe number of ByteBuffers in the input data. -
currentIndex
private int currentIndexCurrentByteBuffer
's indexIf index equals dataSize, then all the data in the InputStream has been consumed
-
currentByteBufferPos
private int currentByteBufferPosThe current position for current ByteBuffer -
hasArray
private boolean hasArrayWhether current ByteBuffer has an array -
currentArray
private byte[] currentArrayIf the current ByteBuffer is unsafe-direct based, currentArray is null; otherwise should be the array inside ByteBuffer. -
currentArrayOffset
private int currentArrayOffsetCurrent ByteBuffer's array offset -
currentAddress
private long currentAddressIf the current ByteBuffer is unsafe-direct based, currentAddress is the start address of this ByteBuffer; otherwise should be zero.
-
-
Constructor Details
-
IterableByteBufferInputStream
IterableByteBufferInputStream(Iterable<ByteBuffer> data)
-
-
Method Details
-
getNextByteBuffer
private boolean getNextByteBuffer() -
updateCurrentByteBufferPos
private void updateCurrentByteBufferPos(int numberOfBytesRead) -
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-