Hoa central
Public Member Functions | List of all members
Hoa\Stringbuffer\Read Class Reference
Inheritance diagram for Hoa\Stringbuffer\Read:

Public Member Functions

 eof ()
 
 read ($length)
 
 readString ($length)
 
 readCharacter ()
 
 readBoolean ()
 
 readInteger ($length=1)
 
 readFloat ($length=1)
 
 readArray ($format=null)
 
 readLine ()
 
 readAll ($offset=0)
 
 scanf ($format)
 
 __toString ()
 
- Public Member Functions inherited from Hoa\Stringbuffer\Stringbuffer
 __construct ($streamName=null)
 
 newBuffer ($callable=null, $size=null)
 
 flush ()
 
 deleteBuffer ()
 
 getBufferLevel ()
 
 getBufferSize ()
 
 lock ($operation)
 
 rewind ()
 
 seek ($offset, $whence=Stream\IStream\Pointable::SEEK_SET)
 
 tell ()
 
 initializeWith ($string)
 
- Public Member Functions inherited from Hoa\Stream\Stream
 __construct ($streamName, $context=null, $wait=false)
 
 open ()
 
 close ()
 
 getStreamName ()
 
 getStreamContext ()
 
 _setStream ($stream)
 
 isOpened ()
 
 setStreamTimeout ($seconds, $microseconds=0)
 
 setStreamBlocking ($mode)
 
 setStreamBuffer ($buffer)
 
 disableStreamBuffer ()
 
 getStreamBufferSize ()
 
 getStreamWrapperName ()
 
 getStreamMetaData ()
 
 isBorrowing ()
 
 on ($listenerId, $callable)
 
 _notify ($ncode, $severity, $message, $code, $transferred, $max)
 
 __toString ()
 
 __destruct ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Hoa\Stream\Stream
static getStreamHandler ($streamName)
 
static _Hoa_Stream ()
 
- Public Attributes inherited from Hoa\Stream\Stream
const NAME = 0
 
const HANDLER = 1
 
const RESOURCE = 2
 
const CONTEXT = 3
 
- Public Attributes inherited from Hoa\Stream\IStream\Lockable
const LOCK_SHARED = LOCK_SH
 
const LOCK_EXCLUSIVE = LOCK_EX
 
const LOCK_RELEASE = LOCK_UN
 
const LOCK_NO_BLOCK = LOCK_NB
 
- Public Attributes inherited from Hoa\Stream\IStream\Pointable
const SEEK_SET = SEEK_SET
 
const SEEK_CURRENT = SEEK_CUR
 
const SEEK_END = SEEK_END
 
- Protected Member Functions inherited from Hoa\Stringbuffer\Stringbuffer
_open ($streamName, Stream\Context $context=null)
 
 _close ()
 
- Protected Member Functions inherited from Hoa\Stream\Stream
_open ($streamName, Context $context=null)
 
 _close ()
 
 getStream ()
 
- Protected Attributes inherited from Hoa\Stream\Stream
 $_bucket = []
 
 $_bufferSize = 8192
 
 $_streamName = null
 
 $_context = null
 
 $_hasBeenDiffered = false
 
 $_on = null
 
 $_borrowed = false
 

Detailed Description

Class .

Read a string buffer.

Definition at line 49 of file Read.php.

Member Function Documentation

Hoa\Stringbuffer\Read::__toString ( )

Transform this object to a string.

Returns
string

Definition at line 183 of file Read.php.

184  {
185  return $this->readAll();
186  }
readAll($offset=0)
Definition: Read.php:162

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Stringbuffer\Read::eof ( )

Test for end-of-file.

Returns
bool

Implements Hoa\Stream\IStream\In.

Definition at line 56 of file Read.php.

57  {
58  return feof($this->getStream());
59  }

Here is the call graph for this function:

Hoa\Stringbuffer\Read::read (   $length)

Read n characters.

Parameters
int$lengthLength.
Returns
string
Exceptions

Implements Hoa\Stream\IStream\In.

Definition at line 68 of file Read.php.

69  {
70  if (0 > $length) {
71  throw new Exception(
72  'Length must be greater than 0, given %d.',
73  0,
74  $length
75  );
76  }
77 
78  return fread($this->getStream(), $length);
79  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Stringbuffer\Read::readAll (   $offset = 0)

Read all, i.e. read as much as possible.

Parameters
int$offsetOffset.
Returns
string

Implements Hoa\Stream\IStream\In.

Definition at line 162 of file Read.php.

163  {
164  return stream_get_contents($this->getStream(), -1, $offset);
165  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Stringbuffer\Read::readArray (   $format = null)

Read an array. Alias of the $this->scanf() method.

Parameters
string$formatFormat (see printf's formats).
Returns
array

Implements Hoa\Stream\IStream\In.

Definition at line 141 of file Read.php.

142  {
143  return $this->scanf($format);
144  }
scanf($format)
Definition: Read.php:173

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readBoolean ( )

Read a boolean.

Returns
bool

Implements Hoa\Stream\IStream\In.

Definition at line 107 of file Read.php.

108  {
109  return (bool) $this->read(1);
110  }
read($length)
Definition: Read.php:68

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readCharacter ( )

Read a character.

Returns
string

Implements Hoa\Stream\IStream\In.

Definition at line 97 of file Read.php.

98  {
99  return fgetc($this->getStream());
100  }

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readFloat (   $length = 1)

Read a float.

Parameters
int$lengthLength.
Returns
float

Implements Hoa\Stream\IStream\In.

Definition at line 129 of file Read.php.

130  {
131  return (float) $this->read($length);
132  }
read($length)
Definition: Read.php:68

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readInteger (   $length = 1)

Read an integer.

Parameters
int$lengthLength.
Returns
int

Implements Hoa\Stream\IStream\In.

Definition at line 118 of file Read.php.

119  {
120  return (int) $this->read($length);
121  }
read($length)
Definition: Read.php:68

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readLine ( )

Read a line.

Returns
string

Implements Hoa\Stream\IStream\In.

Definition at line 151 of file Read.php.

152  {
153  return fgets($this->getStream());
154  }

Here is the call graph for this function:

Hoa\Stringbuffer\Read::readString (   $length)

Alias of $this->read().

Parameters
int$lengthLength.
Returns
string

Implements Hoa\Stream\IStream\In.

Definition at line 87 of file Read.php.

88  {
89  return $this->read($length);
90  }
read($length)
Definition: Read.php:68

Here is the call graph for this function:

Hoa\Stringbuffer\Read::scanf (   $format)

Parse input from a stream according to a format.

Parameters
string$formatFormat (see printf's formats).
Returns
array

Implements Hoa\Stream\IStream\In.

Definition at line 173 of file Read.php.

174  {
175  return fscanf($this->getStream(), $format);
176  }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: