Sgss_File_Stream_Read_Range
Represents a read-only stream with the range limited

Description

Class diagram:
Sgss_File_Stream_Read
 + Sgss_File_Stream_Read_Range
Used by:
Sgss_File_Stream_Read::range()
Author:
Matsuda Shota
Copyright:
(c) 2007-2008 Matsuda Shota
Usedby:
Sgss_File_Stream_Read::range()
License:
http://creativecommons.org/licenses/GPL/2.0/
Located in:
/File/Stream/Read/Range.php (line 46)

Class overview

Variables

protected int $_limit

Limit of this stream in byte

protected int $_offset

Beginning of this stream in byte

Inherited from Sgss_File_Stream_Read:
Sgss_File_Stream_Read::$_file, Sgss_File_Stream_Read::$_handle, Sgss_File_Stream_Read::$_mode

Methods

__construct (string|Sgss_File $file, [string|null $mode = null], [int $offset = 0], [int|null $limit = null])

The constructor

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

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

Inherited from Sgss_File_Stream_Read:
__construct(), close(), eof(), get(), getAll(), getReader(), move(), position(), range(), reset(), seek(), size(), __destruct()

Variable detail

$_limit 

Limit of this stream in byte

Signature:
protected int $_limit


$_offset 

Beginning of this stream in byte

Signature:
protected int $_offset


Method detail

__construct

The constructor

Parameters:
  • string|Sgss_File $file

    File of the stream

  • string|null $mode

    Mode to open the file with

  • int $offset

    Beginning of the stream in byte

  • int|null $limit

    Limit of the stream in byte

Overrides:
Uses:
Sgss_File_Stream_Read::__construct(), Sgss_File_Stream_Read::size(), Sgss_File_Stream_Read::seek()
Signature:
public __construct (string|Sgss_File $file, [string|null $mode = null], [int $offset = 0], [int|null $limit = null])


eof

Determines the pointer reaches the end of this stream

Returns:
boolean -- True when the pointer is at the end of this stream
Overrides:
Related subject:
Sgss_File_Stream_Read::eof()
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
Overrides:
Uses:
Sgss_File_Stream_Read::get()
Related subject:
Sgss_File_Stream_Read::get()
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
Overrides:
Related subject:
Sgss_File_Stream_Read::getAll()
Signature:
public string|null getAll ()


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
Overrides:
Uses:
Sgss_File_Stream_Read::move()
Related subject:
Sgss_File_Stream_Read::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
Overrides:
Uses:
Sgss_File_Stream_Read::position()
Related subject:
Sgss_File_Stream_Read::position()
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
Overrides:
Related subject:
Sgss_File_Stream_Read::range()
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
Overrides:
Uses:
Sgss_File_Stream_Read::seek()
Related subject:
Sgss_File_Stream_Read::reset()
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
Overrides:
Uses:
Sgss_File_Stream_Read::seek()
Related subject:
Sgss_File_Stream_Read::seek()
Signature:
public int seek (int $position)


size

Returns the size of this stream in byte

Returns:
int -- Size of this stream in byte
Overrides:
Related subject:
Sgss_File_Stream_Read::size()
Signature:
public int size ()