ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
AMFReader Class Reference
+ Collaboration diagram for AMFReader:

Public Member Functions

 AMFReader (&$stream)
 
 readData ()
 
 readDouble ()
 
 readBoolean ()
 
 readString ()
 
 readObject ()
 
 readMixedArray ()
 
 readArray ()
 
 readDate ()
 
 readLongString ()
 
 readXML ()
 
 readTypedObject ()
 

Data Fields

 $stream
 

Detailed Description

Definition at line 332 of file module.audio-video.flv.php.

Member Function Documentation

◆ AMFReader()

AMFReader::AMFReader ( $stream)

Definition at line 335 of file module.audio-video.flv.php.

335  {
336  $this->stream =& $stream;
337  }

◆ readArray()

AMFReader::readArray ( )

Definition at line 465 of file module.audio-video.flv.php.

References $data.

465  {
466  $length = $this->stream->readLong();
467 
468  $data = array();
469 
470  for ($i = 0; $i < count($length); $i++) {
471  $data[] = $this->readData();
472  }
473 
474  return $data;
475  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ readBoolean()

AMFReader::readBoolean ( )

Definition at line 413 of file module.audio-video.flv.php.

413  {
414  return $this->stream->readByte() == 1;
415  }

◆ readData()

AMFReader::readData ( )

Definition at line 339 of file module.audio-video.flv.php.

339  {
340  $value = null;
341 
342  $type = $this->stream->readByte();
343 
344  switch($type) {
345  // Double
346  case 0:
347  $value = $this->readDouble();
348  break;
349 
350  // Boolean
351  case 1:
352  $value = $this->readBoolean();
353  break;
354 
355  // String
356  case 2:
357  $value = $this->readString();
358  break;
359 
360  // Object
361  case 3:
362  $value = $this->readObject();
363  break;
364 
365  // null
366  case 6:
367  return null;
368  break;
369 
370  // Mixed array
371  case 8:
372  $value = $this->readMixedArray();
373  break;
374 
375  // Array
376  case 10:
377  $value = $this->readArray();
378  break;
379 
380  // Date
381  case 11:
382  $value = $this->readDate();
383  break;
384 
385  // Long string
386  case 13:
387  $value = $this->readLongString();
388  break;
389 
390  // XML (handled as string)
391  case 15:
392  $value = $this->readXML();
393  break;
394 
395  // Typed object (handled as object)
396  case 16:
397  $value = $this->readTypedObject();
398  break;
399 
400  // Long string
401  default:
402  $value = '(unknown or unsupported data type)';
403  break;
404  }
405 
406  return $value;
407  }

◆ readDate()

AMFReader::readDate ( )

Definition at line 477 of file module.audio-video.flv.php.

References $timestamp.

477  {
478  $timestamp = $this->stream->readDouble();
479  $timezone = $this->stream->readInt();
480  return $timestamp;
481  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

◆ readDouble()

AMFReader::readDouble ( )

Definition at line 409 of file module.audio-video.flv.php.

409  {
410  return $this->stream->readDouble();
411  }

◆ readLongString()

AMFReader::readLongString ( )

Definition at line 483 of file module.audio-video.flv.php.

483  {
484  return $this->stream->readLongUTF();
485  }

◆ readMixedArray()

AMFReader::readMixedArray ( )

Definition at line 441 of file module.audio-video.flv.php.

References $data.

441  {
442  // Get highest numerical index - ignored
443  $highestIndex = $this->stream->readLong();
444 
445  $data = array();
446 
447  while ($key = $this->stream->readUTF()) {
448  // Mixed array record ends with empty string (0x00 0x00) and 0x09
449  if (($key == '') && ($this->stream->peekByte() == 0x09)) {
450  // Consume byte
451  $this->stream->readByte();
452  break;
453  }
454 
455  if (is_numeric($key)) {
456  $key = (float) $key;
457  }
458 
459  $data[$key] = $this->readData();
460  }
461 
462  return $data;
463  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ readObject()

AMFReader::readObject ( )

Definition at line 421 of file module.audio-video.flv.php.

References $data.

421  {
422  // Get highest numerical index - ignored
423  $highestIndex = $this->stream->readLong();
424 
425  $data = array();
426 
427  while ($key = $this->stream->readUTF()) {
428  // Mixed array record ends with empty string (0x00 0x00) and 0x09
429  if (($key == '') && ($this->stream->peekByte() == 0x09)) {
430  // Consume byte
431  $this->stream->readByte();
432  break;
433  }
434 
435  $data[$key] = $this->readData();
436  }
437 
438  return $data;
439  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ readString()

AMFReader::readString ( )

Definition at line 417 of file module.audio-video.flv.php.

417  {
418  return $this->stream->readUTF();
419  }

◆ readTypedObject()

AMFReader::readTypedObject ( )

Definition at line 491 of file module.audio-video.flv.php.

491  {
492  $className = $this->stream->readUTF();
493  return $this->readObject();
494  }

◆ readXML()

AMFReader::readXML ( )

Definition at line 487 of file module.audio-video.flv.php.

487  {
488  return $this->stream->readLongUTF();
489  }

Field Documentation

◆ $stream

AMFReader::$stream

Definition at line 333 of file module.audio-video.flv.php.


The documentation for this class was generated from the following file: