Class StreamFile

java.lang.Object
com.mckoi.store.StreamFile

public class StreamFile extends Object
A RandomAccessFile that acts as an OutputStream, and can also be read as an InputStream.
Author:
Tobias Downer
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Closes the file.
      Throws:
      IOException
    • synch

      public void synch() throws IOException
      Synchs the file.
      Throws:
      IOException
    • delete

      public void delete() throws IOException
      Deletes the file.
      Throws:
      IOException
    • readFully

      public void readFully(long position, byte[] buf, int off, int len) throws IOException
      Fully reads a block from a section of the file into the given byte[] array at the given position.
      Throws:
      IOException
    • length

      public long length()
      Returns the current length of the data.
    • getOutputStream

      public OutputStream getOutputStream() throws IOException
      Opens an OutputStream to the file. Only one output stream may be open on the file at once.
      Throws:
      IOException
    • getInputStream

      public InputStream getInputStream() throws IOException
      Returns an InputStream to the file that allows us to read from the start to the end of the file.
      Throws:
      IOException