public class ByteArrayPushBackInputStream extends PushBackInputStream
buf, pos
in
Constructor and Description |
---|
ByteArrayPushBackInputStream(byte[] input)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Available bytes.
|
boolean |
isEOF()
A simple test to see if we are at the end of the stream.
|
int |
localRead(byte[] buffer,
int off,
int len)
Read a number of bytes.
|
void |
mark(int readlimit)
Save the state of this stream.
|
boolean |
markSupported()
Check if mark is supported.
|
int |
peek()
This will peek at the next byte.
|
int |
read()
Read a byte.
|
int |
read(byte[] buffer)
Read a number of bytes.
|
int |
read(byte[] buffer,
int off,
int len)
Read a number of bytes.
|
void |
reset()
Restore the state of this stream to the last saveState call.
|
int |
seek(int newpos)
Position the stream at a given index.
|
int |
size()
Totally available bytes in the underlying array.
|
long |
skip(long num)
Skips over and discards n bytes of data from this input stream.
|
void |
unread(byte[] buffer)
Pushes back a portion of an array of bytes by copying it to the
front of the pushback buffer.
|
void |
unread(byte[] buffer,
int off,
int len)
Pushes back a portion of an array of bytes by copying it to the
front of the pushback buffer.
|
void |
unread(int by)
Pushes back a byte.
|
fillBuffer, getOffset, readFully, seek
close
public ByteArrayPushBackInputStream(byte[] input) throws IOException
input
- Data to read from. Note that calls to unread() will
modify this array! If this is not desired, pass a copy.IOException
- If there is an IO error.public int peek()
peek
in class PushBackInputStream
public boolean isEOF()
isEOF
in class PushBackInputStream
public void mark(int readlimit)
mark
in class PushbackInputStream
readlimit
- Has no effect.InputStream.mark(int)
public boolean markSupported()
markSupported
in class PushbackInputStream
InputStream.markSupported()
public void reset()
reset
in class PushbackInputStream
InputStream.reset()
public int available()
available
in class PushbackInputStream
InputStream.available()
public int size()
public void unread(int by) throws IOException
unread
in class PushBackInputStream
by
- the int value whose low-order byte is to be pushed back.IOException
- - If there is not enough room in the buffer for the byte.PushbackInputStream.unread(int)
public void unread(byte[] buffer, int off, int len) throws IOException
unread
in class PushBackInputStream
buffer
- the byte array to push back.off
- the start offset of the data.len
- the number of bytes to push back.IOException
- If there is not enough room in the pushback buffer
for the specified number of bytes.PushbackInputStream.unread(byte[], int, int)
public void unread(byte[] buffer) throws IOException
unread
in class PushBackInputStream
buffer
- the byte array to push back.IOException
- If there is not enough room in the pushback buffer
for the specified number of bytes.PushbackInputStream.unread(byte[])
public int read()
read
in class PushBackInputStream
InputStream.read()
public int read(byte[] buffer)
read
in class PushBackInputStream
buffer
- the buffer into which the data is read.InputStream.read(byte[])
public int read(byte[] buffer, int off, int len)
read
in class PushBackInputStream
buffer
- the buffer into which the data is read.off
- the start offset in array buffer at which the data is written.len
- the maximum number of bytes to read.InputStream.read(byte[], int, int)
public int localRead(byte[] buffer, int off, int len)
buffer
- the buffer into which the data is read.off
- the start offset in array buffer at which the data is written.len
- the maximum number of bytes to read.InputStream.read(byte[], int, int)
public long skip(long num)
skip
in class PushbackInputStream
num
- the number of bytes to be skipped.InputStream.skip(long)
public int seek(int newpos)
newpos
- Position in the underlying array. A negative value will be
interpreted as 0, a value greater than size() as size().Copyright © 2002-2015 The Apache Software Foundation. All Rights Reserved.