Class PelDataWindow

Description

The window.

Located in /PelDataWindow.php (line 64)


	
			
Method Summary
 PelDataWindow __construct ([string $d = ''], [boolean $e = PelConvert::LITTLE_ENDIAN])
 void clear ()
 int getByte (int $o)
 PelByteOrder getByteOrder ()
 string getBytes ([int $start = false], [int $size = false])
 PelDataWindow getClone ([mixed $start = false], [mixed $size = false])
 int getLong (int $o)
 array getRational (int $o)
 int getSByte (int $o)
 int getShort (int $o)
 int getSize ()
 int getSLong (int $o)
 array getSRational (int $o)
 int getSShort (int $o)
 void initializeClone (string &$data, int $start, int $size, PelByteOrder $order)
 void setByteOrder (PelByteOrder $o)
 void setWindowSize (int $size)
 void setWindowStart (mixed $start)
 boolean strcmp (int $o, string $str)
 string __toString ()
Methods
Constructor __construct (line 124)

Construct a new data window with the data supplied.

PelDataWindow __construct ([string $d = ''], [boolean $e = PelConvert::LITTLE_ENDIAN])
  • string $d: the data that this window will contain. The data will be copied into the new data window.
  • boolean $e: the initial byte order of the window. This must be either PelConvert::LITTLE_ENDIAN or PelConvert::BIG_ENDIAN. This will be used when integers are read from the data, and it can be changed later with setByteOrder().
clear (line 558)

Clear the data.

This method is for debugging only. It removed the data held by this data window, thereby removing access to it for all clones too. This is useful when a data window object is to be printed with print_r() or a similar function, and the binary output would mess up the terminal or browser.

void clear ()
getByte (line 325)

Return an unsigned byte from the data.

  • return: the unsigned byte found at offset.
int getByte (int $o)
  • int $o: the offset into the data. An offset of zero will return the first byte in the current allowed window. The last valid offset is equal to getSize()-1. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getByteOrder (line 161)

Get the currently used byte order.

  • return: this will be either Convert::LITTLE_ENDIAN or Convert::BIG_ENDIAN.
PelByteOrder getByteOrder ()
getBytes (line 291)

Return some or all bytes visible in the window.

This method works just like the standard http://www.php.net/substr function in PHP with the exception that it works within the window of accessible bytes and does strict range checking.

  • return: a subset of the bytes in the window. This will always return no more than getSize() bytes.
string getBytes ([int $start = false], [int $size = false])
  • int $start: the offset to the first byte returned. If a negative number is given, then the counting will be from the end of the window. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
  • int $size: the size of the sub-window. If a negative number is given, then that many bytes will be omitted from the result.
getClone (line 242)

Make a new data window with the same data as the this window.

The new window will read from the same data as this window, so calling this method is significantly faster than using the built-in clone functionality of PHP.

  • return: a new window that operates on the same data as this window, but (optionally) with a smaller size.
PelDataWindow getClone ([mixed $start = false], [mixed $size = false])
  • mixed $start: if an integer is supplied, then it will be the start of the window in the clone. If left unspecified, then the clone will inherit the start from this object.
  • mixed $size: if an integer is supplied, then it will be the size of the window in the clone. If left unspecified, then the clone will inherit the size from this object.
getLong (line 423)

Return an unsigned long read from the data.

  • return: the unsigned long found at offset.
int getLong (int $o)
  • int $o: the offset into the data. An offset of zero will return the first long available in the current allowed window. The last valid offset is equal to getSize()-4. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getRational (line 475)

Return an unsigned rational read from the data.

  • return: the unsigned rational found at offset. A rational number is represented as an array of two numbers: the enumerator and denominator. Both of these numbers will be unsigned longs.
array getRational (int $o)
  • int $o: the offset into the data. An offset of zero will return the first rational available in the current allowed window. The last valid offset is equal to getSize()-8. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getSByte (line 349)

Return a signed byte from the data.

  • return: the signed byte found at offset.
int getSByte (int $o)
  • int $o: the offset into the data. An offset of zero will return the first byte in the current allowed window. The last valid offset is equal to getSize()-1. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getShort (line 373)

Return an unsigned short read from the data.

  • return: the unsigned short found at offset.
int getShort (int $o)
  • int $o: the offset into the data. An offset of zero will return the first short available in the current allowed window. The last valid offset is equal to getSize()-2. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getSize (line 139)

Get the size of the data window.

  • return: the number of bytes covered by the window. The allowed offsets go from 0 up to this number minus one.
  • see: PelDataWindow::getBytes()
int getSize ()
getSLong (line 448)

Return a signed long read from the data.

  • return: the signed long found at offset.
int getSLong (int $o)
  • int $o: the offset into the data. An offset of zero will return the first long available in the current allowed window. The last valid offset is equal to getSize()-4. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getSRational (line 493)

Return a signed rational read from the data.

  • return: the signed rational found at offset. A rational number is represented as an array of two numbers: the enumerator and denominator. Both of these numbers will be signed longs.
array getSRational (int $o)
  • int $o: the offset into the data. An offset of zero will return the first rational available in the current allowed window. The last valid offset is equal to getSize()-8. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
getSShort (line 398)

Return a signed short read from the data.

  • return: the signed short found at offset.
int getSShort (int $o)
  • int $o: the offset into the data. An offset of zero will return the first short available in the current allowed window. The last valid offset is equal to getSize()-2. Invalid offsets will result in a PelDataWindowOffsetException being thrown.
initializeClone (line 216)

Initialize a copy with data.

This is used internally by getClone to make return a copy with the proper initialization.

void initializeClone (string &$data, int $start, int $size, PelByteOrder $order)
  • string &$data: a reference to the data this copy will hold.
  • int $start: the start of the data window.
  • int $size: the size of the data window.
  • PelByteOrder $order: the byte order of the data.
setByteOrder (line 150)

Change the byte order of the data.

void setByteOrder (PelByteOrder $o)
  • PelByteOrder $o: the new byte order. This must be either Convert::LITTLE_ENDIAN or Convert::BIG_ENDIAN.
setWindowSize (line 191)

Adjust the size of the window.

The size can only be made smaller.

void setWindowSize (int $size)
  • int $size: the desired size of the window. If the argument is negative, the window will be shrunk by the argument.
setWindowStart (line 172)
void setWindowStart (mixed $start)
strcmp (line 513)

String comparison on substrings.

  • return: true if the string given matches the data in the window, at the specified offset, false otherwise. The comparison will stop as soon as a mismatch if found.
boolean strcmp (int $o, string $str)
  • int $o: the offset into the data. An offset of zero will make the comparison start with the very first byte available in the window. The last valid offset is equal to getSize() minus the length of the string. If the string is too long, then a PelDataWindowOffsetException will be thrown.
  • string $str: the string to compare with.
__toString (line 541)

Return a string representation of the data window.

  • return: a description of the window with information about the number of bytes accessible, the total number of bytes, and the window start and stop.
string __toString ()

SourceForge.net Logo Documentation generated on Wed, 21 Jul 2004 19:12:57 +0200 by phpDocumentor 1.3.0RC3