Class IterableByteBufferInputStream

java.lang.Object
java.io.InputStream
com.google.protobuf.IterableByteBufferInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

class IterableByteBufferInputStream extends InputStream
  • Field Details

    • iterator

      private Iterator<ByteBuffer> iterator
      The Iterator with type ByteBuffer of input
    • currentByteBuffer

      private ByteBuffer currentByteBuffer
      The current ByteBuffer;
    • dataSize

      private int dataSize
      The number of ByteBuffers in the input data.
    • currentIndex

      private int currentIndex
      Current ByteBuffer's index

      If index equals dataSize, then all the data in the InputStream has been consumed

    • currentByteBufferPos

      private int currentByteBufferPos
      The current position for current ByteBuffer
    • hasArray

      private boolean hasArray
      Whether current ByteBuffer has an array
    • currentArray

      private byte[] currentArray
      If the current ByteBuffer is unsafe-direct based, currentArray is null; otherwise should be the array inside ByteBuffer.
    • currentArrayOffset

      private int currentArrayOffset
      Current ByteBuffer's array offset
    • currentAddress

      private long currentAddress
      If the current ByteBuffer is unsafe-direct based, currentAddress is the start address of this ByteBuffer; otherwise should be zero.
  • Constructor Details

  • Method Details

    • getNextByteBuffer

      private boolean getNextByteBuffer()
    • updateCurrentByteBufferPos

      private void updateCurrentByteBufferPos(int numberOfBytesRead)
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • read

      public int read(byte[] output, int offset, int length) throws IOException
      Overrides:
      read in class InputStream
      Throws:
      IOException