public final class FileBranchingStream extends BranchingInputStream
BranchingInputStream
for reading from files. Uses a FileInputStream
to read from the file, but
tracks the position read to so that branches can skip to the same location.
This stream would be most suited for when a large file is expected to piped straight to output, without
modification and minimal branching. If the stream is not a large file, is going to be modified by filters, or is
going to have substantial branching, a wrapper BranchingInputStream
could be considered instead.
Constructor and Description |
---|
FileBranchingStream(File file)
Creates a new stream for the specified file.
|
Modifier and Type | Method and Description |
---|---|
BranchingInputStream |
branch()
Creates a new branch at this stream's current position.
|
void |
close()
Closes this branching stream and all of the branches created from it.
|
BranchingInputStream |
copy()
Creates a twin of this stream at this stream's current position.
|
int |
read() |
parent
available, mark, markSupported, read, read, reset, skip
public FileBranchingStream(File file) throws FileNotFoundException
file
- The file to read from.FileNotFoundException
- If the file does not exist.public BranchingInputStream branch() throws IOException
BranchingInputStream
branch
in class BranchingInputStream
IOException
- if an I/O exception occurs.public BranchingInputStream copy() throws IOException
BranchingInputStream
copy
in class BranchingInputStream
IOException
- if an I/O exception occurs.public int read() throws IOException
read
in class InputStream
IOException
public void close() throws IOException
BranchingInputStream
close
in interface Closeable
close
in interface AutoCloseable
close
in class BranchingInputStream
IOException
- if an I/O exception occurs.Copyright © 2010-2018, ForgeRock All Rights Reserved.