Package org.opencastproject.util
Class ChunkedFileInputStream
java.lang.Object
java.io.InputStream
java.io.FileInputStream
org.opencastproject.util.ChunkedFileInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
input stream to get only a part of a file
-
Constructor Summary
ConstructorsConstructorDescriptionChunkedFileInputStream(File file, long offset, long endOffset) constructorChunkedFileInputStream(String name) constructor -
Method Summary
Modifier and TypeMethodDescriptionlongget the ending offsetlongget the starting offsetintread()read the next bytevoidsetEndOffset(long endOffset) set the ending offsetvoidsetOffset(long offset) set the starting offsetMethods inherited from class java.io.FileInputStream
available, close, getChannel, getFD, read, read, readAllBytes, readNBytes, skip, transferToMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readNBytes, reset, skipNBytes
-
Constructor Details
-
ChunkedFileInputStream
constructor- Parameters:
name- the name of the file- Throws:
FileNotFoundException- if the file was not found
-
ChunkedFileInputStream
constructor- Parameters:
file- the file to loadoffset- the starting offsetendOffset- the ending offset- Throws:
FileNotFoundException- if the requested file was not found
-
-
Method Details
-
read
read the next byte- Overrides:
readin classFileInputStream- 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
-