PDF Clown
0.1.2

org.pdfclown.bytes
Interface IBuffer

All Superinterfaces:
Closeable, IDataWrapper, 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.1.2, 01/29/12
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

Nested Class Summary
static interface IBuffer.IListener
          Buffer listener.
 
Method Summary
 void addListener(IBuffer.IListener listener)
          Adds the specified listener.
 IBuffer append(byte data)
          Appends a byte to the buffer.
 IBuffer append(byte[] data)
          Appends a byte array to the buffer.
 IBuffer append(byte[] data, int offset, int length)
          Appends a byte range to the buffer.
 IBuffer append(IInputStream data)
          Appends an IInputStream to the buffer.
 IBuffer append(String data)
          Appends a string to the buffer.
 IBuffer clone()
          Gets a clone of the buffer.
 void decode(Filter filter, PdfDictionary parameters)
          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, PdfDictionary parameters)
          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.
 boolean isDirty()
          Gets whether this buffer has changed.
 boolean removeListener(IBuffer.IListener listener)
          Removes the specified listener.
 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 setDirty(boolean value)
           
 void setLength(int value)
          Sets the used buffer size.
 void writeTo(IOutputStream stream)
          Writes the buffer data to a stream.
 
Methods inherited from interface org.pdfclown.bytes.IInputStream
getByteOrder, getPosition, hashCode, read, read, readByte, readInt, readInt, readLine, readShort, readString, readUnsignedByte, readUnsignedShort, seek, setByteOrder, setPosition, skip
 
Methods inherited from interface org.pdfclown.util.IDataWrapper
toByteArray
 
Methods inherited from interface org.pdfclown.bytes.IOutputStream
write, write, write, write
 
Methods inherited from interface org.pdfclown.bytes.IStream
getLength
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

addListener

void addListener(IBuffer.IListener listener)
Adds the specified listener.

Parameters:
listener - Listener to add.

append

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

Parameters:
data - Byte to copy.
Returns:
This buffer.

append

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

Parameters:
data - Byte array to copy.
Returns:
This buffer.

append

IBuffer 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.
Returns:
This buffer.

append

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

Parameters:
data - String to copy.
Returns:
This buffer.

append

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

Parameters:
data - Source data to copy.
Returns:
This buffer.

clone

IBuffer clone()
Gets a clone of the buffer.

Returns:
Deep copy of the buffer.

decode

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

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

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,
              PdfDictionary parameters)
Applies the specified filter to encode the buffer.

Parameters:
filter - Filter to use for encoding the buffer.
parameters - Encoding parameters.
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.

isDirty

boolean isDirty()
Gets whether this buffer has changed.


removeListener

boolean removeListener(IBuffer.IListener listener)
Removes the specified listener.

Parameters:
listener - Listener to remove.
Returns:
Whether the specified listener has been removed.

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.

setDirty

void setDirty(boolean value)
See Also:
isDirty()

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.1.2

Project home page

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