| @@ 52-67 (lines=16) @@ | ||
| 49 | * |
|
| 50 | * @return int |
|
| 51 | */ |
|
| 52 | public function readUnsignedInteger16() |
|
| 53 | { |
|
| 54 | switch ($this->getByteOrder()) { |
|
| 55 | case ByteOrder::BIG_ENDIAN: |
|
| 56 | $format = 'n'; |
|
| 57 | break; |
|
| 58 | case ByteOrder::LITTLE_ENDIAN: |
|
| 59 | $format = 'v'; |
|
| 60 | break; |
|
| 61 | default: |
|
| 62 | $format = 'S'; |
|
| 63 | } |
|
| 64 | ||
| 65 | list(, $value) = unpack($format, $this->read(2)); |
|
| 66 | return $value; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Read signed 16-bit integer (short) data from the stream |
|
| @@ 154-169 (lines=16) @@ | ||
| 151 | * |
|
| 152 | * @return int |
|
| 153 | */ |
|
| 154 | public function readUnsignedInteger32() |
|
| 155 | { |
|
| 156 | switch ($this->getByteOrder()) { |
|
| 157 | case ByteOrder::BIG_ENDIAN: |
|
| 158 | $format = 'N'; |
|
| 159 | break; |
|
| 160 | case ByteOrder::LITTLE_ENDIAN: |
|
| 161 | $format = 'V'; |
|
| 162 | break; |
|
| 163 | default: |
|
| 164 | $format = 'L'; |
|
| 165 | } |
|
| 166 | ||
| 167 | list(, $value) = unpack($format, $this->read(4)); |
|
| 168 | return $value; |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Read signed 32-bit integer (long) data from the stream |
|
| @@ 195-210 (lines=16) @@ | ||
| 192 | * |
|
| 193 | * @return int |
|
| 194 | */ |
|
| 195 | public function readUnsignedInteger64() |
|
| 196 | { |
|
| 197 | switch ($this->getByteOrder()) { |
|
| 198 | case ByteOrder::BIG_ENDIAN: |
|
| 199 | $format = 'J'; |
|
| 200 | break; |
|
| 201 | case ByteOrder::LITTLE_ENDIAN: |
|
| 202 | $format = 'P'; |
|
| 203 | break; |
|
| 204 | default: |
|
| 205 | $format = 'Q'; |
|
| 206 | } |
|
| 207 | ||
| 208 | list(, $value) = unpack($format, $this->read(8)); |
|
| 209 | return $value; |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * Read signed 64-bit integer (long long) data from the stream |
|