Package org.forgerock.http.io
Class BranchingInputStream
java.lang.Object
java.io.InputStream
org.forgerock.http.io.BranchingInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
FileBranchingStream
An input stream that can branch into separate input streams to perform
divergent reads.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Initialise theBranchingInputStream
with the specified parent. -
Method Summary
Modifier and TypeMethodDescriptionabstract BranchingInputStream
branch()
Creates a new branch at this stream's current position.abstract void
close()
Closes this branching stream and all of the branches created from it.abstract BranchingInputStream
copy()
Creates a twin of this stream at this stream's current position.parent()
Returns the parent branching input stream from which this branch was created, ornull
if this is the trunk.Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
BranchingInputStream
Initialise theBranchingInputStream
with the specified parent.- Parameters:
parent
- The parent stream, or null if it is the trunk.
-
-
Method Details
-
branch
Creates a new branch at this stream's current position. The returned stream will have this stream as its parent.- Returns:
- a new branching stream, in the same position as this branch.
- Throws:
IOException
- if an I/O exception occurs.
-
copy
Creates a twin of this stream at this stream's current position. The returned stream will have the same parent as this stream.- Returns:
- a new twin stream, in the same position as this branch.
- Throws:
IOException
- if an I/O exception occurs.
-
close
Closes this branching stream and all of the branches created from it.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- if an I/O exception occurs.
-
parent
Returns the parent branching input stream from which this branch was created, ornull
if this is the trunk.- Returns:
- the parent branching input stream from which this branch was
created, or
null
if this is the trunk.
-