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().
Return an unsigned byte from the data.
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.
Get the currently used byte order.
PelByteOrder
getByteOrder
()
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.
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.
Make a new data window with the same data as the this window.
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.
Return an unsigned long read from the data.
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.
Return an unsigned rational read from the data.
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.
Return a signed byte from the data.
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.
Return an unsigned short read from the data.
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.
Get the size of the data window.
int
getSize
()
Return a signed long read from the data.
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.
Return a signed rational read from the data.
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.
Return a signed short read from the data.
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.
Change the byte order of the data.
void
setByteOrder
(PelByteOrder $o)
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.
void
setWindowStart
( $start)
String comparison on substrings.
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.
Return a string representation of the data window.
string
__toString
()