Class PelDataWindow

Description

The window.

Located in /src/PelDataWindow.php (line 64)


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

Construct a new data window with the data supplied.

PelDataWindow __construct ([mixed $data = ''], [boolean $endianess = PelConvert::LITTLE_ENDIAN])
  • mixed $data: the data that this window will contain. This can either be given as a string (interpreted litteraly as a sequence of bytes) or a PHP image resource handle. The data will be copied into the new data window.
  • boolean $endianess: 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().
getByte (line 315)

Return an unsigned byte from the data.

  • return: the unsigned byte found at offset.
int getByte ([int $o = 0])
  • 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 177)

Get the currently used byte order.

PelByteOrder getByteOrder ()
getBytes (line 281)

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 233)

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

  • return: a new window that operates on the same data as this window, but (optionally) with a smaller window 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 413)

Return an unsigned long read from the data.

  • return: the unsigned long found at offset.
int getLong ([int $o = 0])
  • 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 465)

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 = 0])
  • 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 339)

Return a signed byte from the data.

  • return: the signed byte found at offset.
int getSByte ([int $o = 0])
  • 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 363)

Return an unsigned short read from the data.

  • return: the unsigned short found at offset.
int getShort ([int $o = 0])
  • 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 154)

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 438)

Return a signed long read from the data.

  • return: the signed long found at offset.
int getSLong ([int $o = 0])
  • 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 483)

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 = 0])
  • 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 388)

Return a signed short read from the data.

  • return: the signed short found at offset.
int getSShort ([int $o = 0])
  • 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.
setByteOrder (line 166)

Change the byte order of the data.

void setByteOrder (PelByteOrder $o)
setWindowSize (line 207)

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 188)
void setWindowStart ( $start)
  • $start
strcmp (line 503)

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 531)

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 ()

Documentation generated on Thu, 05 May 2011 07:18:59 +0200 by phpDocumentor 1.4.3