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 longIf 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 intCurrent ByteBuffer's array offsetprivate ByteBufferThe current ByteBuffer;private intThe current position for current ByteBufferprivate intCurrentByteBuffer's indexprivate intThe number of ByteBuffers in the input data.private booleanWhether current ByteBuffer has an arrayprivate Iterator<ByteBuffer> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanintread()intread(byte[] output, int offset, int length) private voidupdateCurrentByteBufferPos(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:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-