|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.stefanochizzolini.clown.bytes.Buffer
public final class Buffer
Byte buffer.
Constructor Summary | |
---|---|
Buffer()
|
|
Buffer(BufferedReader dataStream)
|
|
Buffer(byte[] data)
|
|
Buffer(byte[] data,
ByteOrder byteOrder)
|
|
Buffer(InputStream dataStream)
|
|
Buffer(int capacity)
|
Method Summary | |
---|---|
void |
append(byte data)
Appends a byte to the buffer. |
void |
append(byte[] data)
Appends a byte array to the buffer. |
void |
append(byte[] data,
int offset,
int length)
Appends a byte range to the buffer. |
void |
append(IInputStream data)
Appends an IInputStream to the buffer. |
void |
append(String data)
Appends a string to the buffer. |
Buffer |
clone()
Gets a clone of the buffer. |
void |
close()
|
void |
decode(Filter filter)
Applies the specified filter to decode the buffer. |
void |
delete(int index,
int length)
Deletes a byte chunk from the buffer. |
byte[] |
encode(Filter filter)
Applies the specified filter to encode the buffer. |
protected boolean |
ensureCapacity(int additionalLength)
Check whether the buffer capacity has sufficient room for adding data. |
protected void |
finalize()
|
int |
getByte(int index)
Gets the byte at a specified location. |
byte[] |
getByteArray(int index,
int length)
Gets the byte range beginning at a specified location. |
ByteOrder |
getByteOrder()
Gets the byte order. |
int |
getCapacity()
Gets the allocated buffer size. |
long |
getLength()
Gets the length of the stream. |
long |
getPosition()
Gets the pointer position. |
String |
getString(int index,
int length)
Gets the string beginning at a specified location. |
void |
insert(int index,
byte[] data)
Inserts a byte array into the buffer. |
void |
insert(int index,
byte[] data,
int offset,
int length)
Inserts a byte range into the buffer. |
void |
insert(int index,
IInputStream data)
Inserts an IInputStream into the buffer. |
void |
insert(int index,
String data)
Inserts a string into the buffer. |
void |
read(byte[] data)
Reads a sequence of bytes from the stream and advances the position within the stream. |
void |
read(byte[] data,
int offset,
int length)
Reads a sequence of bytes from the stream and advances the position within the stream. |
byte |
readByte()
Reads a byte from the stream and advances the position within the stream. |
int |
readInt()
Reads an integer from the stream and advances the position within the stream. |
String |
readLine()
Reads the next line of text. |
short |
readShort()
Reads a short integer from the stream and advances the position within the stream. |
String |
readString(int length)
Reads a string from the stream and advances the position within the stream. |
int |
readUnsignedByte()
Reads an unsigned byte integer from the stream and advances the position within the stream. |
int |
readUnsignedShort()
Reads an unsigned short integer from the stream and advances the position within the stream. |
void |
replace(int index,
byte[] data)
Replaces the buffer contents with a byte array. |
void |
replace(int index,
byte[] data,
int offset,
int length)
Replaces the buffer contents with a byte range. |
void |
replace(int index,
IInputStream data)
Replaces the buffer contents with an IInputStream. |
void |
replace(int index,
String data)
Replaces the buffer contents with a string. |
void |
seek(long position)
Sets the pointer absolute position. |
void |
setByteOrder(ByteOrder value)
Sets the byte order. |
void |
setLength(int value)
Sets the used buffer size. |
void |
setPosition(long value)
Sets the pointer position. |
void |
skip(long offset)
Sets the pointer relative position. |
byte[] |
toByteArray()
Gets the buffer data copied to a newly-allocated byte array. |
void |
write(byte[] data)
Writes a byte array into the stream. |
void |
write(byte[] data,
int offset,
int length)
Writes a byte range into the stream. |
void |
write(IInputStream data)
Writes an IInputStream into the stream. |
void |
write(String data)
Writes a string into the stream. |
void |
writeTo(IOutputStream stream)
Writes the buffer data to a stream. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.stefanochizzolini.clown.bytes.IInputStream |
---|
hashCode |
Constructor Detail |
---|
public Buffer()
public Buffer(int capacity)
public Buffer(BufferedReader dataStream)
public Buffer(InputStream dataStream)
public Buffer(byte[] data)
public Buffer(byte[] data, ByteOrder byteOrder)
Method Detail |
---|
public void append(byte data)
IBuffer
append
in interface IBuffer
data
- Byte to copy.public void append(byte[] data)
IBuffer
append
in interface IBuffer
data
- Byte array to copy.public void append(byte[] data, int offset, int length)
IBuffer
append
in interface IBuffer
data
- Byte array from which the byte range has to be copied.offset
- Location in the byte array at which copying begins.length
- Number of bytes to copy.public void append(String data)
IBuffer
append
in interface IBuffer
data
- String to copy.public void append(IInputStream data)
IBuffer
append
in interface IBuffer
data
- Source data to copy.public Buffer clone()
IBuffer
clone
in interface IBuffer
clone
in class Object
public void decode(Filter filter)
IBuffer
decode
in interface IBuffer
filter
- Filter to use for decoding the buffer.public void delete(int index, int length)
IBuffer
delete
in interface IBuffer
index
- Location at which deletion has to begin.length
- Number of bytes to delete.public byte[] encode(Filter filter)
IBuffer
encode
in interface IBuffer
filter
- Filter to use for encoding the buffer.
public int getByte(int index)
IBuffer
getByte
in interface IBuffer
index
- A location in the buffer.
public byte[] getByteArray(int index, int length)
IBuffer
getByteArray
in interface IBuffer
index
- Location at which the byte range has to begin.length
- Number of bytes to copy.
public String getString(int index, int length)
IBuffer
getString
in interface IBuffer
index
- Location at which the string has to begin.length
- Number of bytes to convert.
public int getCapacity()
IBuffer
getCapacity
in interface IBuffer
public void insert(int index, byte[] data)
IBuffer
insert
in interface IBuffer
index
- Location at which the byte array has to be inserted.data
- Byte array to insert.public void insert(int index, byte[] data, int offset, int length)
IBuffer
insert
in interface IBuffer
index
- Location at which the byte range has to be inserted.data
- Byte array from which the byte range has to be copied.offset
- Location in the byte array at which copying begins.length
- Number of bytes to copy.public void insert(int index, String data)
IBuffer
insert
in interface IBuffer
index
- Location at which the string has to be inserted.data
- String to insert.public void insert(int index, IInputStream data)
IBuffer
insert
in interface IBuffer
index
- Location at which the IInputStream has to be inserted.data
- Source data to copy.public void replace(int index, byte[] data)
IBuffer
replace
in interface IBuffer
index
- Location at which the byte array has to be copied.data
- Byte array to copy.public void replace(int index, byte[] data, int offset, int length)
IBuffer
replace
in interface IBuffer
index
- Location at which the byte range has to be copied.data
- Byte array from which the byte range has to be copied.offset
- Location in the byte array at which copying begins.length
- Number of bytes to copy.public void replace(int index, String data)
IBuffer
replace
in interface IBuffer
index
- Location at which the string has to be copied.data
- String to copy.public void replace(int index, IInputStream data)
IBuffer
replace
in interface IBuffer
index
- Location at which the IInputStream has to be copied.data
- Source data to copy.public void setLength(int value)
IBuffer
setLength
in interface IBuffer
value
- New length.public void writeTo(IOutputStream stream)
IBuffer
writeTo
in interface IBuffer
stream
- Target stream.public ByteOrder getByteOrder()
IInputStream
getByteOrder
in interface IInputStream
public long getLength()
IStream
getLength
in interface IStream
public long getPosition()
IInputStream
getPosition
in interface IInputStream
public void read(byte[] data)
IInputStream
read
in interface IInputStream
data
- Target byte array.public void read(byte[] data, int offset, int length)
IInputStream
read
in interface IInputStream
data
- Target byte array.offset
- Location in the byte array at which storing begins.length
- Number of bytes to copy.public byte readByte() throws EOFException
IInputStream
readByte
in interface IInputStream
EOFException
public int readInt() throws EOFException
IInputStream
readInt
in interface IInputStream
EOFException
public String readLine() throws EOFException
IInputStream
readLine
in interface IInputStream
EOFException
public short readShort() throws EOFException
IInputStream
readShort
in interface IInputStream
EOFException
public String readString(int length)
IInputStream
readString
in interface IInputStream
length
- Number of bytes to read.
public int readUnsignedByte() throws EOFException
IInputStream
readUnsignedByte
in interface IInputStream
EOFException
public int readUnsignedShort() throws EOFException
IInputStream
readUnsignedShort
in interface IInputStream
EOFException
public void seek(long position)
IInputStream
seek
in interface IInputStream
public void setByteOrder(ByteOrder value)
IInputStream
setByteOrder
in interface IInputStream
public void setPosition(long value)
IInputStream
setPosition
in interface IInputStream
public void skip(long offset)
IInputStream
skip
in interface IInputStream
public byte[] toByteArray()
IInputStream
toByteArray
in interface IInputStream
public void close() throws IOException
close
in interface Closeable
IOException
public void write(byte[] data)
IOutputStream
write
in interface IOutputStream
data
- Byte array to write into the stream.public void write(byte[] data, int offset, int length)
IOutputStream
write
in interface IOutputStream
data
- Byte array to write into the stream.offset
- Location in the byte array at which writing begins.length
- Number of bytes to write.public void write(String data)
IOutputStream
write
in interface IOutputStream
data
- String to write into the stream.public void write(IInputStream data)
IOutputStream
IInputStream
into the stream.
write
in interface IOutputStream
data
- IInputStream to write into the stream.protected boolean ensureCapacity(int additionalLength)
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |