Fix comments

git-svn-id: http://php-reader.googlecode.com/svn/trunk@10 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2008-03-12 11:59:45 +00:00
parent 4916e45513
commit afdfc67582
10 changed files with 316 additions and 284 deletions

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -58,19 +59,22 @@ require_once("ASF/FilePropertiesObject.php");
* own classes to ease the correct use of the information.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
class ASF
{
/** @var Reader The Reader object */
/** @var Reader */
private $_reader;
/**
* The default constructor. Initiates the reader for the given file.
* Constructs the ASF class with given file.
*
* @param string $filename The path to the file.
*/
public function __construct($filename)
{
@@ -78,9 +82,11 @@ class ASF
}
/**
* Checks whether there are objects left in the stream.
* Checks whether there are objects left in the stream. Returns
* <var>true</var> if there are objects left in the stream, <var>false</var>
* otherwise.
*
* @return Boolean value corresponding whether there is more to read.
* @return boolean
*/
public function hasObjects()
{
@@ -88,12 +94,12 @@ class ASF
}
/**
* Returns the next ASF object or false if end of stream has been reached.
* Returns the next ASF object or <var>false</var> if end of stream has been
* reached. Returned objects are of the type ASF_Object or of any of its child
* types.
*
* @todo Only the ASF_Header_Object top level object is regognized.
* @return ASF_Object Returns the appropriate object. Returned objects are of
* the type ASF_Object or of any of the other object types that
* inherit from that base class.
* @return ASF_Object
*/
public function nextObject()
{

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -38,47 +39,42 @@ require_once("Object.php");
/**#@-*/
/**
* The ASF_Content_Description_Object object implementation. This object
* The <i>ASF_Content_Description_Object</i> object implementation. This object
* contains five core attribute fields giving more information about the file:
* title, author, description, copyright and rating.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
final class ASF_ContentDescriptionObject extends ASF_Object
{
/**
* @var string The title field.
*/
/** @var string */
private $_title;
/**
* @var string The author field.
*/
/** @var string */
private $_author;
/**
* @var string The copyright field.
*/
/** @var string */
private $_copyright;
/**
* @var string The description field.
*/
/** @var string */
private $_description;
/**
* @var string The rating field.
*/
/** @var string */
private $_rating;
/**
* Default constructor. Initiates the class with given parameters and reads
* object related data from the ASF file.
* Constructs the class with given parameters and reads object related data
* from the ASF file.
*
* @param Reader $reader The reader object.
* @param string $id The object GUID identifier.
* @param integer $size The object size.
*/
public function __construct($reader, $id, $size)
{
@@ -99,36 +95,34 @@ final class ASF_ContentDescriptionObject extends ASF_Object
/**
* Returns the title field.
*
* @return string Returns the title field.
*/
public function getTitle() { return $this->_title; }
/**
* Returns the author field.
*
* @return string Returns the author field.
* @return string
*/
public function getAuthor() { return $this->_author; }
/**
* Returns the copyright field.
*
* @return string Returns the copyright field.
* @return string
*/
public function getCopyright() { return $this->_copyright; }
/**
* Returns the description field.
*
* @return string Returns the description field.
* @return string
*/
public function getDescription() { return $this->_description; }
/**
* Returns the rating field.
*
* @return string Returns the rating field.
* @return string
*/
public function getRating() { return $this->_rating; }
}

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -38,27 +39,30 @@ require_once("Object.php");
/**#@-*/
/**
* The ASF_Extended_Content_Description_Object object implementation. This
* object contains unlimited number of attribute fields giving more information
* about the file.
* The <i>ASF_Extended_Content_Description_Object</i> object implementation.
* This object contains unlimited number of attribute fields giving more
* information about the file.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
final class ASF_ExtendedContentDescriptionObject extends ASF_Object
{
/**
* @var Array An associate array of descriptors and their values.
*/
/** @var Array */
private $_contentDescriptors = array();
/**
* Initiates the object class with given parameters and reads and processes
* the object information from the ASF file.
* Constructs the class with given parameters and reads object related data
* from the ASF file.
*
* @param Reader $reader The reader object.
* @param string $id The object GUID identifier.
* @param integer $size The object size.
*/
public function __construct($reader, $id, $size)
{
@@ -96,7 +100,7 @@ final class ASF_ExtendedContentDescriptionObject extends ASF_Object
* is no such descriptor defined.
*
* @param string $name The name of the descriptor (ie the name of the field).
* @return string Returns the value of a descriptor.
* @return string|false
*/
public function getDescriptor($name)
{

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -38,76 +39,59 @@ require_once("Object.php");
/**#@-*/
/**
* The ASF_File_Properties_Object object implementation. This object contains
* various information about the ASF file.
* The <i>ASF_File_Properties_Object</i> object implementation. This object
* contains various information about the ASF file.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
final class ASF_FilePropertiesObject extends ASF_Object
{
/**
* @var string The file id field.
*/
/** @var string */
private $_fileId;
/**
* @var string The file size field.
*/
/** @var string */
private $_fileSize;
/**
* @var string The creation date field.
*/
/** @var string */
private $_creationDate;
/**
* @var string The data packets count field.
*/
/** @var string */
private $_dataPacketsCount;
/**
* @var string The play duration field.
*/
/** @var string */
private $_playDuration;
/**
* @var string The send duration field.
*/
/** @var string */
private $_sendDuration;
/**
* @var string The preroll field.
*/
/** @var string */
private $_preroll;
/**
* @var string The flags field.
*/
/** @var string */
private $_flags;
/**
* @var string The minimum data packet size field.
*/
/** @var string */
private $_minimumDataPacketSize;
/**
* @var string The maximum data packet size field.
*/
/** @var string */
private $_maximumDataPacketSize;
/**
* @var string The maximum bitrate field.
*/
/** @var string */
private $_maximumBitrate;
/**
* Initiates the object class with given parameters and reads and processes
* the object information from the ASF file.
* Constructs the class with given parameters and reads object related data
* from the ASF file.
*
* @param Reader $reader The reader object.
* @param string $id The object GUID identifier.
* @param integer $size The object size.
*/
public function __construct($reader, $id, $size)
{
@@ -146,63 +130,63 @@ final class ASF_FilePropertiesObject extends ASF_Object
/**
* Returns the file id field.
*
* @return integer Returns the file id field.
* @return integer
*/
public function getFileId() { return $this->_fileId; }
/**
* Returns the file size field.
*
* @return integer Returns the file size field.
* @return integer
*/
public function getFileSize() { return $this->_fileSize; }
/**
* Returns the creation date field.
*
* @return integer Returns the creation date field.
* @return integer
*/
public function getCreationDate() { return $this->_creationDate; }
/**
* Returns the data packets field.
*
* @return integer Returns the data packets field.
* @return integer
*/
public function getDataPacketsCount() { return $this->_dataPacketsCount; }
/**
* Returns the play duration field.
*
* @return integer Returns the play duration field.
* @return integer
*/
public function getPlayDuration() { return $this->_playDuration; }
/**
* Returns the send duration field.
*
* @return integer Returns the send duration field.
* @return integer
*/
public function getSendDuration() { return $this->_sendDuration; }
/**
* Returns the preroll field.
*
* @return integer Returns the preroll field.
* @return integer
*/
public function getPreroll() { return $this->_preroll; }
/**
* Returns the flags field.
*
* @return integer Returns the flags field.
* @return integer
*/
public function getFlags() { return $this->_flags; }
/**
* Returns the minimum data packet size field.
*
* @return integer Returns the minimum data packet size field.
* @return integer
*/
public function getMinimumDataPacketSize()
{
@@ -212,7 +196,7 @@ final class ASF_FilePropertiesObject extends ASF_Object
/**
* Returns the maximum data packet size field.
*
* @return integer Returns the maximum data packet size field.
* @return integer
*/
public function getMaximumDataPacketSize()
{
@@ -222,10 +206,7 @@ final class ASF_FilePropertiesObject extends ASF_Object
/**
* Returns the maximum bitrate field.
*
* @return integer Returns the maximum bitrate field.
* @return integer
*/
public function getMaximumBitrate()
{
return $this->_maximumBitrate;
}
public function getMaximumBitrate() { return $this->_maximumBitrate; }
}

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -38,38 +39,43 @@ require_once("Object.php");
/**#@-*/
/**
* The ASF_Header_Object object implementation. This object contains objects
* that give information about the file. See corresponding object classes for
* more.
* The <i>ASF_Header_Object</i> object implementation. This object contains
* objects that give information about the file. See corresponding object
* classes for more.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
final class ASF_HeaderObject extends ASF_Object
{
/**
* @var integer The number of the objects the header contains.
*/
/** @var integer */
private $_objectCount;
/**
* @var integer Internal variable to have the start of the stream stored in.
* @internal Internal variable to have the start of the stream stored in.
* @var integer
*/
private $_readerSOffset;
/**
* @var integer Internal variable to have the current position of the
* stream pointer stored in.
* @internal Internal variable to have the current position of the stream
* pointer stored in.
* @var integer
*/
private $_readerCOffset;
/**
* Default constructor. Initiates the class with given parameters and reads
* object information from the file.
* Constructs the class with given parameters and reads object related data
* from the ASF file.
*
* @param Reader $reader The reader object.
* @param string $id The object GUID identifier.
* @param integer $size The object size.
*/
public function __construct($reader, $id, $size)
{
@@ -84,15 +90,16 @@ final class ASF_HeaderObject extends ASF_Object
/**
* Returns the number of standard ASF header objects this object contains.
*
* @return integer The number of objects the header contains.
* @return integer
*/
public function getObjectCount() { return $this->_objectCount; }
/**
* Checks whether there is more to be read within the bounds of the parent
* object size.
* object size. Returns <var>true</var> if there are child objects unread,
* <var>false</var> otherwise.
*
* @return boolean Boolean value corresponding whether there is more to read.
* @return boolean
*/
public function hasChildObjects()
{
@@ -100,13 +107,12 @@ final class ASF_HeaderObject extends ASF_Object
}
/**
* Returns the next standard ASF object or <var>false</var> if end of stream
* has been reached.
* Returns the next ASF object or <var>false</var> if end of stream has been
* reached. Returned objects are of the type <var>ASFObject</var> or of any of
* the other object types that inherit from that base class.
*
* @todo Only limited subset of possible child objects are regognized.
* @return ASF_Object Returns the appropriate object. Returned objects are of
* the type ASFObject or of any of the other object types that inherit
* from that base class.
* @return ASF_Object|false
*/
public function nextChildObject()
{

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,37 +27,49 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ASF
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**
* The base class for all ASF objects.
*
* @package php-reader
* @subpackage ASF
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
class ASF_Object
{
/**
* @var Reader The reader associated with this object.
* The reader object.
*
* @var Reader
*/
protected $_reader;
/**
* @var string Object's ID
*/
/** @var string */
private $_id;
/**
* @var integer Object size in bytes.
* The object size in bytes.
*
* @var integer
*/
protected $_size;
/**
* Constructs the object with the given parameters.
* Constructs the class with given parameters.
*
* @param Reader $reader The reader object.
* @param string $id The object GUID identifier.
* @param integer $size The object size.
*/
public function __construct($reader, $id, $size)
{
@@ -73,7 +81,7 @@ class ASF_Object
/**
* Returns the GUID of the ASF object.
*
* @return string Returns the GUID of the ASF object.
* @return string
*/
public function getID() { return $this->_id; }
public function getIdentifier() { return $this->_id; }
}

View File

@@ -1,9 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,6 +27,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @subpackage ID3
* @copyright Copyright (c) 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -41,35 +42,40 @@ require_once("Reader.php");
* {@link http://www.id3.org/id3v2-00 The ID3-Tag Specification Appendix}.
*
* @package php-reader
* @subpackage ID3
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2008 BEHR Software Systems
* @copyright Copyright (c) 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
class ID3v1
final class ID3v1
{
/** @var string The title */
/** @var string */
private $_title;
/** @var string The artist */
/** @var string */
private $_artist;
/** @var string The album */
/** @var string */
private $_album;
/** @var string The year */
/** @var string */
private $_year;
/** @var string The comment */
/** @var string */
private $_comment;
/** @var integer The track number */
/** @var integer */
private $_track;
/** @var integer The genre index */
/** @var integer */
private $_genre = 128;
/** @var Array The genre list */
/**
* The genre list.
*
* @var Array
*/
public static $genres = array
("Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
"Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
@@ -94,11 +100,13 @@ class ID3v1
"Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
"Dance Hall", "Unknown");
/** @var Reader The Reader object */
/** @var Reader */
private $_reader;
/**
* The default constructor. Initiates the reader for the given file.
* Constructs the ID3v1 class with given file.
*
* @param string $filename The path to the file.
*/
public function __construct($filename)
{
@@ -127,50 +135,50 @@ class ID3v1
/**
* Returns the title field.
*
* @return string Returns the title field.
* @return string
*/
public function getTitle() { return $this->_title; }
/**
* Returns the artist field.
*
* @return string Returns the artist field.
* @return string
*/
public function getArtist() { return $this->_artist; }
/**
* Returns the album field.
*
* @return string Returns the album field.
* @return string
*/
public function getAlbum() { return $this->_album; }
/**
* Returns the year field.
*
* @return string Returns the year field.
* @return string
*/
public function getYear() { return $this->_year; }
/**
* Returns the comment field.
*
* @return string Returns the comment field.
* @return string
*/
public function getComment() { return $this->_comment; }
/**
* Returns the track field.
*
* @note ID3v1.1 feature only
* @return integer Returns the track field.
* @since ID3v1.1
* @return integer
*/
public function getTrack() { return $this->_track; }
/**
* Returns the genre.
*
* @return string Returns the genre.
* @return string
*/
public function getGenre() {
if (isset(self::$genres[$this->_genre]))
@@ -182,7 +190,7 @@ class ID3v1
/**
* Magic function so that $obj->value will work.
*
* @param string $name
* @param string $name The field name.
* @return mixed
*/
public function __get($name) {

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**#@+ @ignore */
@@ -45,27 +45,23 @@ require_once("Transform.php");
*
* @package php-reader
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/
class Reader
{
/**
* @var resource The underlying file descriptor.
*/
/** @var resource */
private $_fd;
/**
* @var integer The file size.
*/
/** @var integer */
private $_size;
/**
* Opens the file given as a parameter.
* Constructs the Reader class with given file.
*
* @param string $filename The absolute or relative path to the file.
* @param string $filename The path to the file.
* @throws Reader_Exception if the file cannot be read.
*/
public function __construct($filename)
@@ -87,10 +83,11 @@ class Reader
}
/**
* Checks whether there is more to be read in the file.
* Checks whether there is more to be read in the file. Returns
* <var>true</var> if the end of the file has not yet been reached;
* <var>false</var> otherwise.
*
* @return boolean Returns <var>true</var> if the end of the file has not yet
* been reached; <var>false</var> otherwise.
* @return boolean
*/
public function available()
{
@@ -100,6 +97,7 @@ class Reader
/**
* Jumps <var>size</var> amount of bytes in the file stream.
*
* @param integer $size The amount of bytes.
* @return void
* @throws Reader_Exception if <var>size</var> attribute is negative.
*/
@@ -115,7 +113,8 @@ class Reader
/**
* Reads <var>length</var> amount of bytes from the file stream.
*
* @return string Returns read bytes as a string
* @param integer $length The amount of bytes.
* @return string
* @throws Reader_Exception if <var>length</var> attribute is negative.
*/
public function read($length)
@@ -130,7 +129,7 @@ class Reader
/**
* Returns the current point of operation.
*
* @return integer Returns the current cursor position.
* @return integer
*/
public function getOffset()
{
@@ -138,8 +137,11 @@ class Reader
}
/**
* Sets the point of operation, ie the cursor offset value.
* Sets the point of operation, ie the cursor offset value. The offset can
* also be set to a negative value when it is interpreted as an offset from
* the end of the file instead of the beginning.
*
* @param integer $offset The new point of operation.
* @return void
*/
public function setOffset($offset)
@@ -150,7 +152,7 @@ class Reader
/**
* Returns the file size in bytes.
*
* @return integer Returns the file size in bytes.
* @return integer
*/
public function getSize()
{
@@ -158,8 +160,8 @@ class Reader
}
/**
* Magic function to delegate the call to helper methods of Transform class
* to transform read data in another format.
* Magic function to delegate the call to helper methods of
* <var>Transform</var> class to transform read data in another format.
*
* The read data length is determined from the helper method name. For methods
* where arbitrary data lengths are accepted a parameter can be used to

View File

@@ -1,9 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,15 +27,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @copyright Copyright (c) 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**
* The ReaderException is thrown whenever an error occurs within the Reader
* The Reader_Exception is thrown whenever an error occurs within the Reader
* class during a file operation.
*
* @package php-reader
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2008 BEHR Software Systems
* @copyright Copyright (c) 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
*/

View File

@@ -1,10 +1,6 @@
<?php
/**
* $Id$
*
*
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
* Copyright (C) 2007, 2008 BEHR Software Systems. All Rights Reserved.
* PHP Reader Library
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,6 +27,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package php-reader
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Id$
*/
/**
@@ -38,8 +38,8 @@
*
* @package php-reader
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
* @copyright 2006, 2007 The Bearpaw Project Work Group
* @copyright 2007, 2008 BEHR Software Systems
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version $Rev$
* @static
@@ -61,7 +61,9 @@ final class Transform
* aritmetic operations it is implicitly converted into floating point which
* is of 64-bits long.
*
* @return integer Returns the resulting 64-bit integer.
* @param string $raw The raw data string.
* @param integer $order The byte order of the raw string.
* @return integer
*/
public static function getInt64($raw, $order = self::MACHINE_ENDIAN_ORDER)
{
@@ -76,7 +78,8 @@ final class Transform
* aritmetic operations it is implicitly converted into floating point which
* is of 64-bits long.
*
* @return integer Returns the resulting 64-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getInt64LE($raw)
{
@@ -89,7 +92,8 @@ final class Transform
* aritmetic operations it is implicitly converted into floating point which
* is of 64-bits long.
*
* @return integer Returns the resulting 64-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getInt64BE($raw)
{
@@ -99,7 +103,8 @@ final class Transform
/**
* Returns machine-endian ordered binary data as signed 32-bit integer.
*
* @return integer Returns the resulting signed 32-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getInt32($raw)
{
@@ -110,7 +115,9 @@ final class Transform
/**
* Returns machine-endian ordered binary data as unsigned 32-bit integer.
*
* @return integer Returns the resulting unsigned 32-bit integer.
* @param string $raw The raw data string.
* @param integer $order The byte order of the raw string.
* @return integer
*/
public static function getUInt32($raw, $order = self::MACHINE_ENDIAN_ORDER)
{
@@ -122,7 +129,8 @@ final class Transform
/**
* Returns little-endian ordered binary data as unsigned 32-bit integer.
*
* @return integer Returns the resulting unsigned 32-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getUInt32LE($raw)
{
@@ -132,7 +140,8 @@ final class Transform
/**
* Returns big-endian ordered binary data as unsigned 32-bit integer.
*
* @return integer Returns the resulting unsigned 32-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getUInt32BE($raw)
{
@@ -142,7 +151,8 @@ final class Transform
/**
* Returns machine endian ordered binary data as signed 16-bit integer.
*
* @return integer Returns the resulting signed 16-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getInt16($raw)
{
@@ -153,7 +163,9 @@ final class Transform
/**
* Returns machine endian ordered binary data as unsigned 16-bit integer.
*
* @return integer Returns the resulting unsigned 16-bit integer.
* @param string $raw The raw data string.
* @param integer $order The byte order of the raw string.
* @return integer
*/
public static function getUInt16($raw, $order)
{
@@ -165,7 +177,8 @@ final class Transform
/**
* Returns little-endian ordered binary data as unsigned 16-bit integer.
*
* @return integer Returns the resulting unsigned 16-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getUInt16LE($raw)
{
@@ -175,7 +188,8 @@ final class Transform
/**
* Returns big-endian ordered binary data as unsigned 16-bit integer.
*
* @return integer Returns the resulting unsigned 16-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getUInt16BE($raw)
{
@@ -185,7 +199,8 @@ final class Transform
/**
* Returns binary data as 8-bit integer.
*
* @return integer Returns the resulting 8-bit integer.
* @param string $raw The raw data string.
* @return integer
*/
public static function getInt8($raw)
{
@@ -195,7 +210,8 @@ final class Transform
/**
* Returns binary data as string. Removes terminating zero.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @return string
*/
public static function getString8($raw)
{
@@ -206,9 +222,11 @@ final class Transform
}
/**
* Returns machine-endian ordered binary data as string.
* Returns machine-endian ordered binary data as multibyte string.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @param integer $order The byte order of the raw string.
* @return string
*/
public static function getString16($raw, $order = self::MACHINE_ENDIAN_ORDER)
{
@@ -220,9 +238,10 @@ final class Transform
}
/**
* Returns little-endian ordered binary data as string.
* Returns little-endian ordered binary data as multibyte string.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @return string
*/
public static function getString16LE($raw)
{
@@ -230,9 +249,10 @@ final class Transform
}
/**
* Returns big-endian ordered binary data as string.
* Returns big-endian ordered binary data as multibyte string.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @return string
*/
public static function getString16BE($raw)
{
@@ -242,7 +262,8 @@ final class Transform
/**
* Returns binary data as hexadecimal string having high nibble first.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @return string
*/
public static function getHHex($raw)
{
@@ -253,7 +274,8 @@ final class Transform
/**
* Returns binary data as hexadecimal string having low nibble first.
*
* @return string Returns the resulting string.
* @param string $raw The raw data string.
* @return string
*/
public static function getLHex($raw)
{
@@ -265,7 +287,8 @@ final class Transform
* Returns the little-endian ordered raw data as big-endian ordered
* hexadecimal GUID string.
*
* @return string Returns the raw data in appropriate GUID format.
* @param string $raw The raw data string.
* @return string
*/
public static function getGUID($raw)
{