# org.pdfclown.bytes.Buffer Class Reference

Byte buffer. More...

Inheritance diagram for org.pdfclown.bytes.Buffer:

List of all members.

## Public Member Functions
IBuffer | Append (System.IO.Stream data)
| Appends a stream to the buffer.
IBuffer | Append (IInputStream data)
| Appends an IInputStream to the buffer.
IBuffer | Append (string data)
| Appends a string to the buffer.
IBuffer | Append (byte[] data, int offset, int length)
| Appends a byte range to the buffer.
IBuffer | Append (byte[] data)
| Appends a byte array to the buffer.
IBuffer | Append (byte data)
| Appends a byte to the buffer.
| Buffer (System.IO.Stream data)
| Buffer (byte[] data)
| Buffer (int capacity)
| 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.
void | Dispose ()
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 | GetHashCode ()
| Gets the hash representation of the sequence.
string | GetString (int index, int length)
| Gets the string beginning at a specified location.
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 | Insert (int index, byte[] data, int offset, int length)
| Inserts a byte range into the buffer.
void | Insert (int index, byte[] data)
| Inserts a byte array into the buffer.
void | Read (byte[] data, int offset, int length)
| Reads a sequence of bytes.
void | Read (byte[] data)
| Reads a sequence of bytes.
int | ReadByte ()
| Reads a byte.
int | ReadInt (int length)
| Reads a variable-length integer.
int | ReadInt ()
| Reads an integer.
string | ReadLine ()
| Reads the next line of text.
short | ReadShort ()
| Reads a short integer.
sbyte | ReadSignedByte ()
| Reads a signed byte integer.
string | ReadString (int length)
| Reads a string.
ushort | ReadUnsignedShort ()
| Reads an unsigned short integer.
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 | Replace (int index, byte[] data, int offset, int length)
| Replaces the buffer contents with a byte range.
void | Replace (int index, byte[] data)
| Replaces the buffer contents with a byte array.
void | Seek (long offset)
| Sets the pointer absolute position.
void | SetLength (int value)
| Sets the used buffer size.
void | Skip (long offset)
| Sets the pointer relative position.
byte[] | ToByteArray ()
| Gets the buffer data copied to a newly-allocated byte array.
void | Write (IInputStream data)
| Writes an IInputStream into the stream.
void | Write (string data)
| Writes a string into the stream.
void | Write (byte[] data, int offset, int length)
| Writes a byte range into the stream.
void | Write (byte[] data)
| Writes a byte array into the stream.
void | WriteTo (IOutputStream stream)
| Writes the buffer data to a stream.
## Properties
ByteOrderEnum | ByteOrder`[get, set]`
| Gets/Sets the byte order.
int | Capacity`[get]`
| Gets the allocated buffer size.
bool | Dirty`[get, set]`
| Gets/Sets whether this buffer has changed.
long | Length`[get]`
| Gets the length of the stream.
long | Position`[get, set]`
| Gets/Sets the pointer position.
## Events
EventHandler | OnChange
| Notifies the dirtiness of the observed buffer.

##

Byte buffer.

## Constructor & Destructor Documentation

org.pdfclown.bytes.Buffer.Buffer | ( |  | ) |

org.pdfclown.bytes.Buffer.Buffer | ( | int | capacity | ) |

org.pdfclown.bytes.Buffer.Buffer | ( | byte[] | data | ) |

org.pdfclown.bytes.Buffer.Buffer | ( | System.IO.Stream | data | ) |

## Member Function Documentation

IBuffer org.pdfclown.bytes.Buffer.Append | ( | System.IO.Stream | data | ) |

Appends a stream to the buffer.

Parameters:

  | data | Source data to copy.

Returns:
  This buffer.

Implements org.pdfclown.bytes.IBuffer.

IBuffer org.pdfclown.bytes.Buffer.Append | ( | IInputStream | data | ) |

Appends an IInputStream to the buffer.

Parameters:

  | data | Source data to copy.

Returns:
  This buffer.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Append(), org.pdfclown.bytes.IStream.Length, and org.pdfclown.util.IDataWrapper.ToByteArray().

Referenced by org.pdfclown.bytes.Buffer.Append().

IBuffer org.pdfclown.bytes.Buffer.Append | ( | string | data | ) |

Appends a string to the buffer.

Parameters:

  | data | String to copy.

Returns:
  This buffer.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Append().

Referenced by org.pdfclown.bytes.Buffer.Append().

IBuffer org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

IBuffer org.pdfclown.bytes.Buffer.Append | ( | byte[] | data | ) |

Appends a byte array to the buffer.

Parameters:

  | data | Byte array to copy.

Returns:
  This buffer.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Append().

Referenced by org.pdfclown.bytes.Buffer.Append().

IBuffer org.pdfclown.bytes.Buffer.Append | ( | byte | data | ) |

Appends a byte to the buffer.

Parameters:

  | data | Byte to copy.

Returns:
  This buffer.

Implements org.pdfclown.bytes.IBuffer.

IBuffer org.pdfclown.bytes.Buffer.Clone | ( |  | ) |

Gets a clone of the buffer.

Returns:
  Deep copy of the buffer.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.IBuffer.Append().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.filters.Filter.Decode().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.Dispose | ( |  | ) |

byte [] org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.filters.Filter.Encode().

int org.pdfclown.bytes.Buffer.GetByte | ( | int | index | ) |

Gets the byte at a specified location.

Parameters:

  | index | A location in the buffer.

Returns:
  Byte at the specified location.

Implements org.pdfclown.bytes.IBuffer.

byte [] org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

int org.pdfclown.bytes.IInputStream.GetHashCode | ( |  | ) | `[inherited]`

Gets the hash representation of the sequence.

Implemented in org.pdfclown.bytes.Stream.

Referenced by org.pdfclown.util.parsers.PostScriptParser.GetHashCode().

string org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Insert(), and org.pdfclown.util.IDataWrapper.ToByteArray().

Referenced by org.pdfclown.bytes.Buffer.Insert().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Insert().

Referenced by org.pdfclown.bytes.Buffer.Insert().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Insert().

Referenced by org.pdfclown.bytes.Buffer.Insert().

void org.pdfclown.bytes.Buffer.Read | ( | byte[] | data,
|  | int | offset,
|  | int | length |
| ) |  |  |

Reads a sequence of bytes.

This operation causes the stream pointer to advance after the read data.

Parameters:

  | data | Target byte array.
  | offset | Location in the byte array at which storing begins.
  | length | Number of bytes to read.

Implements org.pdfclown.bytes.IInputStream.

void org.pdfclown.bytes.Buffer.Read | ( | byte[] | data | ) |

Reads a sequence of bytes.

This operation causes the stream pointer to advance after the read data.

Parameters:

  | data | Target byte array.

Implements org.pdfclown.bytes.IInputStream.

References org.pdfclown.bytes.Buffer.Read().

Referenced by org.pdfclown.bytes.Buffer.Read().

int org.pdfclown.bytes.Buffer.ReadByte | ( |  | ) |

Reads a byte.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

int org.pdfclown.bytes.Buffer.ReadInt | ( | int | length | ) |

Reads a variable-length integer.

This operation causes the stream pointer to advance after the read data.

Parameters:

  | length | Number of bytes to read.

Implements org.pdfclown.bytes.IInputStream.

int org.pdfclown.bytes.Buffer.ReadInt | ( |  | ) |

Reads an integer.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

string org.pdfclown.bytes.Buffer.ReadLine | ( |  | ) |

Reads the next line of text.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

short org.pdfclown.bytes.Buffer.ReadShort | ( |  | ) |

Reads a short integer.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

sbyte org.pdfclown.bytes.Buffer.ReadSignedByte | ( |  | ) |

Reads a signed byte integer.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

string org.pdfclown.bytes.Buffer.ReadString | ( | int | length | ) |

Reads a string.

This operation causes the stream pointer to advance after the read data.

Parameters:

  | length | Number of bytes to read.

Implements org.pdfclown.bytes.IInputStream.

ushort org.pdfclown.bytes.Buffer.ReadUnsignedShort | ( |  | ) |

Reads an unsigned short integer.

This operation causes the stream pointer to advance after the read data.

Implements org.pdfclown.bytes.IInputStream.

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Replace(), and org.pdfclown.util.IDataWrapper.ToByteArray().

Referenced by org.pdfclown.bytes.Buffer.Replace().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.Buffer.Replace().

Referenced by org.pdfclown.bytes.Buffer.Replace().

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.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.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.Seek | ( | long | position | ) |

Sets the pointer absolute position.

Implements org.pdfclown.bytes.IInputStream.

void org.pdfclown.bytes.Buffer.SetLength | ( | int | value | ) |

Sets the used buffer size.

Parameters:

  | value | New length.

Implements org.pdfclown.bytes.IBuffer.

void org.pdfclown.bytes.Buffer.Skip | ( | long | offset | ) |

Sets the pointer relative position.

Implements org.pdfclown.bytes.IInputStream.

byte [] org.pdfclown.bytes.Buffer.ToByteArray | ( |  | ) |

Gets the buffer data copied to a newly-allocated byte array.

Implements org.pdfclown.util.IDataWrapper.

void org.pdfclown.bytes.Buffer.Write | ( | IInputStream | data | ) |

Writes an IInputStream into the stream.

Parameters:

  | data | IInputStream to write into the stream.

Implements org.pdfclown.bytes.IOutputStream.

void org.pdfclown.bytes.Buffer.Write | ( | string | data | ) |

Writes a string into the stream.

Parameters:

  | data | String to write into the stream.

Implements org.pdfclown.bytes.IOutputStream.

void org.pdfclown.bytes.Buffer.Write | ( | byte[] | data,
|  | int | offset,
|  | int | length |
| ) |  |  |

Writes a byte range into the stream.

Parameters:

  | data | Byte array to write into the stream.
  | offset | Location in the byte array at which writing begins.
  | length | Number of bytes to write.

Implements org.pdfclown.bytes.IOutputStream.

void org.pdfclown.bytes.Buffer.Write | ( | byte[] | data | ) |

Writes a byte array into the stream.

Parameters:

  | data | Byte array to write into the stream.

Implements org.pdfclown.bytes.IOutputStream.

void org.pdfclown.bytes.Buffer.WriteTo | ( | IOutputStream | stream | ) |

Writes the buffer data to a stream.

Parameters:

  | stream | Target stream.

Implements org.pdfclown.bytes.IBuffer.

References org.pdfclown.bytes.IOutputStream.Write().

## Property Documentation

ByteOrderEnum org.pdfclown.bytes.Buffer.ByteOrder`[get, set]`

Gets/Sets the byte order.

Implements org.pdfclown.bytes.IInputStream.

int org.pdfclown.bytes.Buffer.Capacity`[get]`

Gets the allocated buffer size.

Returns:
  Allocated buffer size.

Implements org.pdfclown.bytes.IBuffer.

bool org.pdfclown.bytes.Buffer.Dirty`[get, set]`

Gets/Sets whether this buffer has changed.

Implements org.pdfclown.bytes.IBuffer.

long org.pdfclown.bytes.Buffer.Length`[get]`

Gets the length of the stream.

Implements org.pdfclown.bytes.IStream.

long org.pdfclown.bytes.Buffer.Position`[get, set]`

Gets/Sets the pointer position.

Implements org.pdfclown.bytes.IInputStream.

## Event Documentation

EventHandler org.pdfclown.bytes.Buffer.OnChange

Notifies the dirtiness of the observed buffer.

Implements org.pdfclown.bytes.IBuffer.

Copyright 2006-2013 Stefano Chizzolini. For more information, please visit PDF Clown home page.