PDF Clown
0.0.8

it.stefanochizzolini.clown.bytes
Interface IBuffer

All Superinterfaces:
Closeable, IInputStream, IOutputStream, IStream
All Known Implementing Classes:
Buffer

public interface IBuffer
extends IInputStream, IOutputStream

Buffer interface.

Its pivotal concept is the array index.

Version:
0.0.8
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

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.
 IBuffer clone()
          Gets a clone of the buffer.
 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.
 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.
 int getCapacity()
          Gets the allocated buffer size.
 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 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 setLength(int value)
          Sets the used buffer size.
 void writeTo(IOutputStream stream)
          Writes the buffer data to a stream.
 
Methods inherited from interface it.stefanochizzolini.clown.bytes.IInputStream
getByteOrder, getPosition, hashCode, read, read, readByte, readInt, readLine, readShort, readString, readUnsignedByte, readUnsignedShort, seek, setByteOrder, setPosition, skip, toByteArray
 
Methods inherited from interface it.stefanochizzolini.clown.bytes.IOutputStream
write, write, write, write
 
Methods inherited from interface it.stefanochizzolini.clown.bytes.IStream
getLength
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

append

void append(byte data)
Appends a byte to the buffer.

Parameters:
data - Byte to copy.

append

void append(byte[] data)
Appends a byte array to the buffer.

Parameters:
data - Byte array to copy.

append

void append(byte[] data,
            int offset,
            int length)
Appends a byte range to the buffer.

Parameters:
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.

append

void append(String data)
Appends a string to the buffer.

Parameters:
data - String to copy.

append

void append(IInputStream data)
Appends an IInputStream to the buffer.

Parameters:
data - Source data to copy.

clone

IBuffer clone()
Gets a clone of the buffer.

Returns:
Deep copy of the buffer.

decode

void decode(Filter filter)
Applies the specified filter to decode the buffer.

Parameters:
filter - Filter to use for decoding the buffer.

delete

void delete(int index,
            int length)
Deletes a byte chunk from the buffer.

Parameters:
index - Location at which deletion has to begin.
length - Number of bytes to delete.

encode

byte[] encode(Filter filter)
Applies the specified filter to encode the buffer.

Parameters:
filter - Filter to use for encoding the buffer.
Returns:
Encoded buffer.

getByte

int getByte(int index)
Gets the byte at a specified location.

Parameters:
index - A location in the buffer.
Returns:
Byte at the specified location.

getByteArray

byte[] getByteArray(int index,
                    int length)
Gets the byte range beginning at a specified location.

Parameters:
index - Location at which the byte range has to begin.
length - Number of bytes to copy.
Returns:
Byte range beginning at the specified location.

getString

String getString(int index,
                 int length)
Gets the string beginning at a specified location.

Parameters:
index - Location at which the string has to begin.
length - Number of bytes to convert.
Returns:
String beginning at the specified location.

getCapacity

int getCapacity()
Gets the allocated buffer size.

Returns:
Allocated buffer size.

insert

void insert(int index,
            byte[] data)
Inserts a byte array into the buffer.

Parameters:
index - Location at which the byte array has to be inserted.
data - Byte array to insert.

insert

void insert(int index,
            byte[] data,
            int offset,
            int length)
Inserts a byte range into the buffer.

Parameters:
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.

insert

void insert(int index,
            String data)
Inserts a string into the buffer.

Parameters:
index - Location at which the string has to be inserted.
data - String to insert.

insert

void insert(int index,
            IInputStream data)
Inserts an IInputStream into the buffer.

Parameters:
index - Location at which the IInputStream has to be inserted.
data - Source data to copy.

replace

void replace(int index,
             byte[] data)
Replaces the buffer contents with a byte array.

Parameters:
index - Location at which the byte array has to be copied.
data - Byte array to copy.

replace

void replace(int index,
             byte[] data,
             int offset,
             int length)
Replaces the buffer contents with a byte range.

Parameters:
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.

replace

void replace(int index,
             String data)
Replaces the buffer contents with a string.

Parameters:
index - Location at which the string has to be copied.
data - String to copy.

replace

void replace(int index,
             IInputStream data)
Replaces the buffer contents with an IInputStream.

Parameters:
index - Location at which the IInputStream has to be copied.
data - Source data to copy.

setLength

void setLength(int value)
Sets the used buffer size.

Parameters:
value - New length.

writeTo

void writeTo(IOutputStream stream)
Writes the buffer data to a stream.

Parameters:
stream - Target stream.

PDF Clown
0.0.8

Project home page

Copyright © 2006-2010 Stefano Chizzolini. Some Rights Reserved.
This documentation is available under the terms of the GNU Free Documentation License.