Sgss_File_Reader
Reads bytes from the Sgss_File_Stream_Read object

Description

Class diagram:
Sgss_File_Reader_Abstract
 + Sgss_File_Reader
Used by:
Sgss_File::getReader(),Sgss_File_Stream_Read::getReader()
Author:
Matsuda Shota
Copyright:
(c) 2007-2008 Matsuda Shota
Usedby:
Sgss_File::getReader()
License:
http://creativecommons.org/licenses/GPL/2.0/
Usedby:
Sgss_File_Stream_Read::getReader()
Located in:
/File/Reader.php (line 51)

Class overview

Variable

protected Sgss_File_Stream_Read $_stream

Stream to read

Inherited from Sgss_File_Reader_Abstract:
Sgss_File_Reader_Abstract::$_position, Sgss_File_Reader_Abstract::$_size

Methods

__construct (Sgss_File_Stream_Read $stream)

The constructor

boolean close ()

Closes the stream

int move (int $position)

Moves the pointer of the stream to the specified position in byte without reading the contents

string read ([int $length = 1])

Reads the contents and moves the pointer of the stream by the specified length of bytes

string readAll ()

Reads all the contents of the stream

int reset ()

Moves the pointer of the stream to the first

Inherited from Sgss_File_Reader_Abstract:
filter(), move(), position(), size(), skip()

Variable detail

$_stream 

Stream to read

Signature:
protected Sgss_File_Stream_Read $_stream


Method detail

__construct

The constructor

Parameters:
Throws:
  • Sgss_File_Reader_Exception

    When unable to obtain the infomation of the specified stream necessary to initialize the reader

Uses:
Sgss_File_Stream_Read::position(), Sgss_File_Stream_Read::size()
Signature:
public __construct (Sgss_File_Stream_Read $stream)


close

Closes the stream

Returns:
boolean -- True when successfully closed the stream
Uses:
Sgss_File_Stream_Interface::close()
Related subject:
Sgss_File_Reader_Interface::close()
Signature:
public boolean close ()


move

Moves the pointer of the stream to the specified position in byte without reading the contents

Parameters:
  • int $position

    Position in byte to which the pointer moves

Returns:
int -- Offset length in byte, from the previous position to the position after this operation
Throws:
  • Sgss_File_Reader_Exception

    When unable to move the pointer of the stream

Overrides:
Uses:
Sgss_File_Reader_Abstract::move(), Sgss_File_Stream_Read::seek()
Related subject:
Sgss_File_Reader_Interface::move()
Signature:
public int move (int $position)


read

Reads the contents and moves the pointer of the stream by the specified length of bytes

Parameters:
  • int $length

    Length in byte to read

Returns:
string -- Retrieved byte string
Throws:
  • Sgss_File_Reader_Exception

    When attempting to read beyond the end of stream

Uses:
Sgss_File_Stream_Read::get()
Related subject:
Sgss_File_Reader_Interface::read()
Signature:
public string read ([int $length = 1])


readAll

Reads all the contents of the stream

Returns:
string -- Retrieved byte string
Throws:
  • Sgss_File_Reader_Exception

    When unable to read the content of the stream

Uses:
Sgss_File_Stream_Read::getAll()
Related subject:
Sgss_File_Reader_Interface::readAll()
Signature:
public string readAll ()


reset

Moves the pointer of the stream to the first

Returns:
int -- Offset length in byte, from the previous position to the position after this operation
Related subject:
Sgss_File_Reader_Interface::reset()
Signature:
public int reset ()