Sgss_File_Stream_Write
Represents a write-only stream

Description

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

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

Sgss_File_Writer getWriter ()

Creates and returns the writer of this stream

int put (string $bytes)

Puts the specified bytes at the end of this stream

int size ()

Returns the size of the 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

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


__destruct

The destructor

Uses:
Sgss_File_Stream_Write::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_Write::__destruct()
Related subject:
Sgss_File_Stream_Interface::close()
Signature:
public boolean close ()


getWriter

Creates and returns the writer of this stream

Returns:
Sgss_File_Writer -- Writer pointing to this stream
Uses:
Sgss_File_Writer
Signature:
public Sgss_File_Writer getWriter ()


put

Puts the specified bytes at the end of this stream

Parameters:
  • string $bytes

    Bytes to put into the stream

Returns:
int -- True when successfully put the bytes into this stream
Used by:
Sgss_File_Writer::write()
Signature:
public int put (string $bytes)


size

Returns the size of the stream in byte

Returns:
int -- Size of the stream in byte
Used by:
Sgss_File_Writer::__construct()
Signature:
public int size ()