public class ByteArrayBranchingStream extends BranchingInputStream
Constructor and Description |
---|
ByteArrayBranchingStream(byte[] data)
Constructs a new branching input stream that wraps a byte array.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without
blocking by the next invocation of a method for this input stream.
|
ByteArrayBranchingStream |
branch()
Creates a new branch at this stream's current position.
|
void |
close()
Has no effect.
|
void |
mark(int readlimit)
Marks the current position in this input stream.
|
boolean |
markSupported()
Returns
true unconditionally; mark and reset are supported. |
ByteArrayBranchingStream |
parent()
Returns the parent branching input stream from which this branch was
created, or
null if this is the trunk. |
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer
array
b . |
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the input stream into an array of bytes. |
void |
reset()
Repositions this stream to the position at the time the
mark method was last
called on this input stream. |
long |
skip(long n)
Skips over and discards
n bytes of data from this input stream. |
public ByteArrayBranchingStream(byte[] data)
data
- byte array to wrap with the branching input stream.public ByteArrayBranchingStream branch()
BranchingInputStream
branch
in class BranchingInputStream
public ByteArrayBranchingStream parent()
BranchingInputStream
null
if this is the trunk.parent
in class BranchingInputStream
null
if this is the trunk.public int read()
read
in class InputStream
-1
if the end of the stream is reached.public int read(byte[] b)
b
.read
in class InputStream
b
- the buffer into which the data is read.-1
is there is no more data because the
end of the stream has been reached.public int read(byte[] b, int off, int len)
len
bytes of data from the input stream into an array of bytes.read
in class InputStream
b
- the buffer into which the data is read.off
- the start offset in array b
at which the data is written.len
- the maximum number of bytes to read.-1
if there is no more data because the
end of the stream has been reached.public long skip(long n)
n
bytes of data from this input stream.skip
in class InputStream
n
- the number of bytes to be skipped.public int available()
available
in class InputStream
public boolean markSupported()
true
unconditionally; mark and reset are supported.markSupported
in class InputStream
true
unconditionally.public void mark(int readlimit)
mark
in class InputStream
readlimit
- the maximum limit of bytes that can be read before the mark position becomes invalid.public void reset() throws IOException
mark
method was last
called on this input stream.reset
in class InputStream
IOException
- if the position was not previously marked.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class BranchingInputStream
Copyright © 2014 ForgeRock AS. All rights reserved.