Class BlockAwareSegmentInputStreamImpl

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class BlockAwareSegmentInputStreamImpl
    extends BlockAwareSegmentInputStream
    The BlockAwareSegmentInputStreamImpl for each cold storage data block. It gets data from ledger, and will be read out the content for a data block. DataBlockHeader + entries(each with format[[entry_size -- int][entry_id -- long][entry_data]]) + padding
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockAwareSegmentInputStreamImpl​(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int calculateBlockSize​(int maxBlockSize, org.apache.bookkeeper.client.api.ReadHandle readHandle, long firstEntryToWrite, long entryBytesAlreadyWritten)  
      void close()  
      int getBlockEntryBytesCount()
      Get sum of entries data size read from the this InputStream.
      int getBlockEntryCount()
      Get entry count that read out from this InputStream.
      int getBlockSize()
      Get block size that could read out from this InputStream.
      int getDataBlockFullOffset()  
      long getEndEntryId()
      Get end entry id contained in this InputStream.
      static long getHeaderSize()  
      org.apache.bookkeeper.client.api.ReadHandle getLedger()
      Get the ledger, from which this InputStream read data.
      long getStartEntryId()
      Get start entry id contained in this InputStream.
      int read()  
      int read​(byte[] b, int off, int len)  
      • Methods inherited from class java.io.InputStream

        available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BlockAwareSegmentInputStreamImpl

        public BlockAwareSegmentInputStreamImpl​(org.apache.bookkeeper.client.api.ReadHandle ledger,
                                                long startEntryId,
                                                int blockSize)
    • Method Detail

      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • getDataBlockFullOffset

        public int getDataBlockFullOffset()
      • getHeaderSize

        public static long getHeaderSize()
      • calculateBlockSize

        public static int calculateBlockSize​(int maxBlockSize,
                                             org.apache.bookkeeper.client.api.ReadHandle readHandle,
                                             long firstEntryToWrite,
                                             long entryBytesAlreadyWritten)