Class HdfsPositionedUnderFileInputStream

  • All Implemented Interfaces:
    alluxio.Positioned, alluxio.PositionReader, alluxio.Seekable, java.io.Closeable, java.lang.AutoCloseable

    public class HdfsPositionedUnderFileInputStream
    extends alluxio.underfs.SeekableUnderFileInputStream
    implements alluxio.PositionReader
    The input stream of HDFS as under filesystem. This input stream has two mode of operations. Under sequential mode, it uses the read api and can take advantage of underlying stream's buffering. Under random read mode, it uses the positionedRead FSDataInputStream API. This stream can be cached for reuse.
    • Field Summary

      • Fields inherited from class java.io.FilterInputStream

        in
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      long getPos()  
      boolean markSupported()  
      int read()  
      int read​(byte[] b)  
      int read​(byte[] buffer, int offset, int length)
      If there has been a number of sequential reads in a row, we move to regular buffered reads.
      int readInternal​(long position, alluxio.file.ReadTargetBuffer buffer, int length)  
      void seek​(long position)  
      long skip​(long n)  
      • Methods inherited from class java.io.FilterInputStream

        mark, reset
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface alluxio.PositionReader

        read, read, read, read, read
    • Method Detail

      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • getPos

        public long getPos()
        Specified by:
        getPos in interface alluxio.Positioned
      • read

        public int read()
        Overrides:
        read in class java.io.FilterInputStream
      • read

        public int read​(byte[] b)
        Overrides:
        read in class java.io.FilterInputStream
      • read

        public int read​(byte[] buffer,
                        int offset,
                        int length)
        If there has been a number of sequential reads in a row, we move to regular buffered reads.
        Overrides:
        read in class java.io.FilterInputStream
      • seek

        public void seek​(long position)
        Specified by:
        seek in interface alluxio.Seekable
      • skip

        public long skip​(long n)
        Overrides:
        skip in class java.io.FilterInputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.FilterInputStream
      • readInternal

        public int readInternal​(long position,
                                alluxio.file.ReadTargetBuffer buffer,
                                int length)
                         throws java.io.IOException
        Specified by:
        readInternal in interface alluxio.PositionReader
        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
        Specified by:
        close in interface alluxio.PositionReader
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException