Class FixedSizeDataStore.SectorInputStream

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

    private final class FixedSizeDataStore.SectorInputStream
    extends java.io.InputStream
    An input stream that reads information across a sector chain starting at the given head sector.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int count
      The number of bytes we have read.
      private int index
      Current index in buf.
      private int sector
      The current sector we are traversing.
      private byte[] sector_buffer
      A reference to the sector buffer.
    • Constructor Summary

      Constructors 
      Constructor Description
      SectorInputStream​(int sector_head)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void loadNextSector()
      Loads the next sector in the chain into sector_buffer and sets index to the start of the buffer.
      int read()  
      int read​(byte[] b, int offset, int len)  
      long skip​(long len)  
      • Methods inherited from class java.io.InputStream

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

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

      • sector

        private int sector
        The current sector we are traversing.
      • index

        private int index
        Current index in buf.
      • count

        private int count
        The number of bytes we have read.
      • sector_buffer

        private byte[] sector_buffer
        A reference to the sector buffer.
    • Constructor Detail

      • SectorInputStream

        SectorInputStream​(int sector_head)
                   throws java.io.IOException
        Constructor.
        Throws:
        java.io.IOException
    • Method Detail

      • loadNextSector

        private void loadNextSector()
                             throws java.io.IOException
        Loads the next sector in the chain into sector_buffer and sets index to the start of the buffer.
        Throws:
        java.io.IOException
      • read

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

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

        public long skip​(long len)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException