Table of Contents

RawData

This object represents raw, unformatted data.

Functions

RawData

Constructor function.

Syntax

var myObject = new RawData();
var myObject = new RawData(otherRawData);

Arguments

  1. otherRawData - (RawData) other RawData to copy

Exceptions

Example

Create an empty RawData.

var myObject = new RawData();

Create a RawData representing a copy of otherRawData.

var myObject = new RawData(otherRawData);

Methods

clone

Returns a copy of this RawData.

Syntax

myObject.clone();

Returns

Example

var copyOfMyObject = myObject.clone();

equals

Returns true if this RawData and another are referencing the same data.

Syntax

myObject.equals(other);

Arguments

  1. other - (RawData) another RawData

Returns

Example

if(myFirstObject.equals(mySecondObject))
	//Do something

toString

Returns a string representing this RawData.

Syntax

myObject.toString();

Returns

Example

Console.print(myObject.toString());

Notes

This method is automatically called when trying to convert a RawData to a string.

append

Appends data to this RawData.

Syntax

myObject.append(data);

Arguments

  1. data - (mixed) the data to append

Returns

Example

myObject.append("some text");
myObject.append(1337);

chop

Removes n bytes from the end of this RawData.

Syntax

myObject.chop(n);

Arguments

  1. n - (integer) the number of bytes to remove

Returns

clear

Clears the content of this RawData.

Syntax

myObject.clear();

Returns

contains

Returns true if this RawData contains an occurrence of some other data.

Syntax

myObject.contains(data);

Arguments

  1. data - (mixed) the data to search for

Returns

count

Returns the number of occurrences of some other data in this RawData.

Syntax

myObject.count(data);

Arguments

  1. data - (mixed) the data to search for

Returns

endsWith

Returns true if this RawData ends with some other data.

Syntax

myObject.endsWith(data);

Arguments

  1. data - (mixed) some other data

Returns

indexOf

Returns the position of the first occurrence of some data, starting at from.

Syntax

myObject.indexOf(data);
myObject.indexOf(data, from);

Arguments

  1. data - (mixed) some other data
  2. from - (integer) the position where to start

Returns

isEmpty

Returns true if this RawData is empty.

Syntax

myObject.isEmpty();

Returns

lastIndexOf

Returns the position of the last occurrence of some data.

Syntax

myObject.lastIndexOf(data);

Arguments

  1. data - (mixed) some other data

Returns

left

Returns a new RawData that contains the leftmost len bytes of this RawData.

Syntax

myObject.left(len);

Arguments

  1. len - (integer) the number of bytes

Returns

length

Returns the length of this RawData.

Syntax

myObject.length();

Returns

mid

Returns a new RawData containing len bytes, starting at position pos.

Syntax

myObject.mid(pos);
myObject.mid(pos, len);

Arguments

  1. pos - (integer) the starting position
  2. len - (integer) the number of bytes

Returns

prepend

Prepends data to this RawData.

Syntax

myObject.prepend(data);

Arguments

  1. data - (mixed) the data to prepend

Returns

Example

myObject.prepend("some text");
myObject.prepend(1337);

remove

Remove len bytes, starting at position pos.

Syntax

myObject.remove(pos);
myObject.remove(pos, len);

Arguments

  1. pos - (integer) the starting position
  2. len - (integer) the number of bytes

Returns

replace

Replace every occurrence of before with after.

Syntax

myObject.replace(before, after);

Arguments

  1. before - (string) the string to find
  2. after - (string) the replacement

Returns

resize

Resizes this RawData.

Syntax

myObject.resize(size);

Arguments

  1. size - (integer) the new size

Returns

Returns a new RawData that contains the rightmost len bytes of this RawData.

Syntax

myObject.right(len);

Arguments

  1. len - (integer) the number of bytes

Returns

setData

Sets the data of this RawData.

Syntax

myObject.setData(data);

Arguments

  1. data - (mixed) the new data

Returns

size

Returns the size of this RawData.

Syntax

myObject.size();

Returns

startsWith

Returns true if this RawData starts with some other data.

Syntax

myObject.startsWith(data);

Arguments

  1. data - (mixed) some other data

Returns

convertToNumber

Try to convert this RawData to a number.

Syntax

myObject.convertToNumber();

Returns

convertToString

Try to convert this RawData to a string.

Syntax

myObject.convertToString(encoding);

Arguments

  1. encoding - (Encoding) the encoding to use

Returns

truncate

Truncates the RawData at index position pos.

Syntax

myObject.truncate(pos);

Arguments

  1. pos - (integer) the index position

Returns