Sgss_File_Stream_Read
Represents a read-only file stream

Description

Implements:
Sgss_File_Stream_Interface
Used by:
Sgss_Font_Parser_Abstract::_init(),Sgss_File::open()
Author:
Matsuda Shota
Copyright:
(c) 2007-2008 Matsuda Shota
Usedby:
Sgss_Font_Parser_Abstract::_init()
License:
http://creativecommons.org/licenses/GPL/2.0/
Usedby:
Sgss_File::open()
Located in:
/File/Stream/Read.php (line 56)

Direct descendant

Sgss_File_Stream_Read_Range Represents a read-only stream with the range limited

Class overview

Variables

protected Sgss_File $_file

File of the stream

protected resource $_handle

Stream resource

protected string $_mode

Mode with which the stream being opened

Methods

__construct (string|Sgss_File $file, [string|null $mode = null])

The constructor

__destruct ()

The destructor

boolean close ()

Destructs the stream resource

boolean eof ()

Determines the pointer reaches the end of this stream

string|null get (int $length)

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

string|null getAll ()

Reads all the contents of this stream

Sgss_File_Reader getReader ()

Creates and returns the reader of this stream

boolean move (int $offset, int $length)

Moves the pointer of this stream by the specified length of bytes

int position ()

Returns the current pointer position of this stream in byte

Sgss_File_Stream_Read range ([int $offset = 0], [int|null $limit = null])

Returns the stream object whose range is limited by the specified parameters

boolean reset ()

Moves the pointer of this stream to the first

int seek (int $position)

Moves the pointer of this stream to the specified position

int size ()

Returns the size of this stream in byte

Variable detail

$_file 

File of the stream

Signature:
protected Sgss_File $_file


$_handle 

Stream resource

Signature:
protected resource $_handle


$_mode 

Mode with which the stream being opened

Signature:
protected string $_mode


Method detail

__construct

The constructor

Parameters:
  • string|Sgss_File $file

    File of the stream

  • string|null $mode

    Mode to open the file with

Throws:
  • Sgss_File_Stream_Exception

    When any error occurred while constructing the stream resource

Overridden by:
Used by:
Sgss_File_Stream_Read_Range::__construct()
Signature:
public __construct (string|Sgss_File $file, [string|null $mode = null])


__destruct

The destructor

Uses:
Sgss_File_Stream_Read::close()
Signature:
public __destruct ()


close

Destructs the stream resource

Returns:
boolean -- True when successfully destructed the stream resource
Specified by:
Used by:
Sgss_File_Stream_Read::__destruct()
Related subject:
Sgss_File_Stream_Interface::close()
Signature:
public boolean close ()


eof

Determines the pointer reaches the end of this stream

Returns:
boolean -- True when the pointer is at the end of this stream
Overridden by:
Signature:
public boolean eof ()


get

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

Parameters:
  • int $length

    Length in byte to read

Returns:
string|null -- Retrieved byte string, or null if unable to retrieve that
Overridden by:
Used by:
Sgss_File_Stream_Read_Range::get(), Sgss_File_Reader::read()
Signature:
public string|null get (int $length)


getAll

Reads all the contents of this stream

Returns:
string|null -- Retrieved byte string, or null if unable to retrieve that
Overridden by:
Used by:
Sgss_File_Reader::readAll()
Signature:
public string|null getAll ()


getReader

Creates and returns the reader of this stream

Returns:
Sgss_File_Reader -- Reader pointing to this stream
Uses:
Sgss_File_Reader
Used by:
Sgss_Font_Truetype_Parser::getTableReader(), Sgss_Font_Parser_Abstract::_init()
Signature:
public Sgss_File_Reader getReader ()


move

Moves the pointer of this stream by the specified length of bytes

Parameters:
  • int $length

    Length in byte by which the pointer moves

  • $offset
Returns:
boolean -- True when successfully moved the pointer of this stream
Overridden by:
Used by:
Sgss_File_Stream_Read_Range::move()
Signature:
public boolean move (int $offset, int $length)


position

Returns the current pointer position of this stream in byte

Returns:
int -- Current pointer position of this stream in byte
Overridden by:
Used by:
Sgss_File_Stream_Read_Range::position(), Sgss_File_Reader::__construct()
Signature:
public int position ()


range

Returns the stream object whose range is limited by the specified parameters

Parameters:
  • int $offset

    Beginning of the stream in byte

  • int|null $limit

    Limit of the stream in byte

Returns:
Sgss_File_Stream_Read -- Stream object whose range is limited by the specified parameters
Overridden by:
Uses:
Sgss_File_Stream_Read_Range
Used by:
Sgss_Font_Truetype_Parser::getTableReader()
Signature:
public Sgss_File_Stream_Read range ([int $offset = 0], [int|null $limit = null])


reset

Moves the pointer of this stream to the first

Returns:
boolean -- True when successfully moved the pointer of this stream
Overridden by:
Signature:
public boolean reset ()


seek

Moves the pointer of this stream to the specified position

Parameters:
  • int $position

    Position in byte to which the pointer moves

Returns:
int -- True when successfully moved the pointer of this stream
Overridden by:
Used by:
Sgss_File_Stream_Read_Range::reset(), Sgss_File_Stream_Read_Range::seek(), Sgss_File_Stream_Read_Range::__construct(), Sgss_File_Reader::move()
Signature:
public int seek (int $position)


size

Returns the size of this stream in byte

Returns:
int -- Size of this stream in byte
Overridden by:
Used by:
Sgss_File_Stream_Read_Range::__construct(), Sgss_File_Reader::__construct()
Signature:
public int size ()