public interface Buffer extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
append(byte b)
Appends a single byte to the end of the buffer.
|
void |
append(byte[] b,
int off,
int len)
Appends
len bytes from the specified byte array starting at offset off
to the end of the buffer. |
void |
close()
Closes the buffer and releases any system resources associated with it.
|
int |
length()
Returns the current length of the buffer.
|
byte |
read(int pos)
Reads a single byte of data from the buffer.
|
int |
read(int pos,
byte[] b,
int off,
int len)
Reads up to
len bytes of data from the buffer into an array of bytes. |
byte read(int pos) throws IOException
pos
- the offset position, measured in bytes from the beginning of the buffer, at which to read the data.IOException
- if an I/O exception occurs.IndexOutOfBoundsException
- if pos
exceeds the buffer length.int read(int pos, byte[] b, int off, int len) throws IOException
len
bytes of data from the buffer into an array of bytes. An
attempt is made to read as many as len
bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.pos
- the offset position, measured in bytes from the beginning of the buffer, at which to read the data.b
- the array of bytes to write the data to.off
- the start offset in the array at which the data is written.len
- the maximum number of bytes to read.IOException
- if an I/O exception occurs.void append(byte b) throws IOException
b
- the byte to append.IOException
- if an I/O exception occurs.OverflowException
- if appending a single byte to the buffer would exceed its limit.void append(byte[] b, int off, int len) throws IOException
len
bytes from the specified byte array starting at offset off
to the end of the buffer.b
- the array of bytes to read the data from.off
- the start offset in the array at which the data is read.len
- the number of bytes to be appended to the buffer.IOException
- if an I/O exception occurs.OverflowException
- if appending len
bytes to the buffer would exceed its limit.int length() throws IOException
IOException
- if an I/O exception occurs.void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if an I/O exception occurs.Copyright © 2010-2018, ForgeRock All Rights Reserved.