Class InputStreamFromRandomAccessFile

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

    public class InputStreamFromRandomAccessFile
    extends java.io.InputStream
    Provides an InputStream view into the current position in a RandomAccessFile.

    Useful for performing buffered reading from a RandomAccessFile which otherwise isn't possible without using Java 7. So instead of reading directly from a RandomAccessFile once you have set a position, instead construct : new DataInputStream(new BufferedInputStream(new InputStreamFromRandomAccessFile(randomAccessFile),64)) to read from instead. Note that closing the stream created does not forward the close on to the random access file.

    Since:
    API 4.40 (Geneious 5.4.0)
    See Also:
    OutputStreamToRandomAccessFile
    • Constructor Summary

      Constructors 
      Constructor Description
      InputStreamFromRandomAccessFile​(java.io.RandomAccessFile file)
      Constructs a new input stream from the current location in the given random access file
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read()  
      int read​(byte[] b)  
      int read​(byte[] b, int off, int len)  
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, 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

      • InputStreamFromRandomAccessFile

        public InputStreamFromRandomAccessFile​(java.io.RandomAccessFile file)
        Constructs a new input stream from the current location in the given random access file
        Parameters:
        file - the random access file
    • Method Detail

      • read

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

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • 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