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

Public Member Functions

 write ($string, $length)
 
 writeString ($string)
 
 writeCharacter ($char)
 
 writeBoolean ($boolean)
 
 writeInteger ($integer)
 
 writeFloat ($float)
 
 writeArray (Array $array)
 
 writeLine ($line)
 
 writeAll ($string)
 
 truncate ($size)
 
- 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 .

Write into a string buffer.

Definition at line 49 of file Write.php.

Member Function Documentation

Hoa\Stringbuffer\Write::truncate (   $size)

Truncate a file to a given length.

Parameters
int$sizeSize.
Returns
bool

Implements Hoa\Stream\IStream\Out.

Definition at line 180 of file Write.php.

181  {
182  return ftruncate($this->getStream(), $size);
183  }

Here is the call graph for this function:

Hoa\Stringbuffer\Write::write (   $string,
  $length 
)

Write n characters.

Parameters
string$stringString.
int$lengthLength.
Returns
mixed
Exceptions

Implements Hoa\Stream\IStream\Out.

Definition at line 59 of file Write.php.

60  {
61  if (0 > $length) {
62  throw new Exception(
63  'Length must be greater than 0, given %d.',
64  0,
65  $length
66  );
67  }
68 
69  return fwrite($this->getStream(), $string, $length);
70  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Stringbuffer\Write::writeAll (   $string)

Write all, i.e. as much as possible.

Parameters
string$stringString.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 169 of file Write.php.

170  {
171  return $this->write($string, strlen($string));
172  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeArray ( Array  $array)

Write an array.

Parameters
array$arrayArray.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 139 of file Write.php.

140  {
141  $array = var_export($array, true);
142 
143  return $this->write($array, strlen($array));
144  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeBoolean (   $boolean)

Write a boolean.

Parameters
bool$booleanBoolean.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 102 of file Write.php.

103  {
104  return $this->write((string) (bool) $boolean, 1);
105  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeCharacter (   $char)

Write a character.

Parameters
string$charCharacter.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 91 of file Write.php.

92  {
93  return $this->write((string) $char[0], 1);
94  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeFloat (   $float)

Write a float.

Parameters
float$floatFloat.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 126 of file Write.php.

127  {
128  $float = (string) (float) $float;
129 
130  return $this->write($float, strlen($float));
131  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeInteger (   $integer)

Write an integer.

Parameters
int$integerInteger.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 113 of file Write.php.

114  {
115  $integer = (string) (int) $integer;
116 
117  return $this->write($integer, strlen($integer));
118  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeLine (   $line)

Write a line.

Parameters
string$lineLine.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 152 of file Write.php.

153  {
154  if (false === $n = strpos($line, "\n")) {
155  return $this->write($line . "\n", strlen($line) + 1);
156  }
157 
158  ++$n;
159 
160  return $this->write(substr($line, 0, $n), $n);
161  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:

Hoa\Stringbuffer\Write::writeString (   $string)

Write a string.

Parameters
string$stringString.
Returns
mixed

Implements Hoa\Stream\IStream\Out.

Definition at line 78 of file Write.php.

79  {
80  $string = (string) $string;
81 
82  return $this->write($string, strlen($string));
83  }
write($string, $length)
Definition: Write.php:59

Here is the call graph for this function:


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