76 private $_byteArray = array();
98 private $_lastPosition = 0;
109 private $_position = 0;
128 $this->_lastPosition = $this->_position;
129 $this->_position = $position;
148 return $this->_position;
168 return $this->_lastPosition;
185 public function writeBytes($bytes, $offset =
false, $inject =
false)
194 $this->_bytes .= $bytes;
201 for ($i = 0; $i < $countFillBytes; $i++) {
202 $fillBytes .= pack(
"H", 0x00);
204 $this->_bytes .= $fillBytes;
205 $this->_bytes .= $bytes;
208 } elseif ($offset < strlen($this->_bytes)+1) {
214 $bytesB = substr($this->_bytes, 0, $offset-1);
215 $bytesA = substr($this->_bytes, ($offset-1)+strlen($bytes), strlen($this->_bytes)-(($offset-1)+strlen($bytes)));
216 $this->_bytes = $bytesB . $bytes . $bytesA;
221 $bytesB = substr($this->_bytes, 0, $offset-1);
222 $bytesA = substr($this->_bytes, $offset-1, strlen($this->_bytes)-($offset-1));
223 $this->_bytes = $bytesB . $bytes . $bytesA;
224 $this->
setPosition(strlen($this->_bytes) . strlen($bytes));
245 return substr($this->_bytes, $offset, $length);
264 return $this->_bytes;
271 $bytes = $this->
readBytes($offset, $length);
272 $bytes = unpack(
'N', $bytes);
273 return $bytes[count($bytes)];
279 $bytes = $this->
readBytes($offset, $length);
286 $bytes = $this->
readBytes($offset, $length);
287 $bytes = unpack(
'd', $bytes);
288 return $bytes[count($bytes)];
294 return strlen($this->_bytes);