Class ChunkedFileInputStream

java.lang.Object
java.io.InputStream
java.io.FileInputStream
org.opencastproject.util.ChunkedFileInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class ChunkedFileInputStream extends FileInputStream
input stream to get only a part of a file
  • Constructor Details

    • ChunkedFileInputStream

      public ChunkedFileInputStream(String name) throws FileNotFoundException
      constructor
      Parameters:
      name - the name of the file
      Throws:
      FileNotFoundException - if the file was not found
    • ChunkedFileInputStream

      public ChunkedFileInputStream(File file, long offset, long endOffset) throws FileNotFoundException
      constructor
      Parameters:
      file - the file to load
      offset - the starting offset
      endOffset - the ending offset
      Throws:
      FileNotFoundException - if the requested file was not found
  • Method Details

    • read

      public int read() throws IOException
      read the next byte
      Overrides:
      read in class FileInputStream
      Returns:
      the next byte or -1 if the expected offset has been reached
      Throws:
      IOException
    • getEndOffset

      public long getEndOffset()
      get the ending offset
      Returns:
      the ending offset
    • setEndOffset

      public void setEndOffset(long endOffset)
      set the ending offset
      Parameters:
      endOffset - the ending offset
    • getOffset

      public long getOffset()
      get the starting offset
      Returns:
      the starting offset
    • setOffset

      public void setOffset(long offset)
      set the starting offset
      Parameters:
      offset - the starting offset