setasign\SetaPDF2\Core\Writer

TempStreamWriter A writer class for temporary streams

File: /SetaPDF v2/Core/Writer/TempStreamWriter.php
Old class name (alias): \SetaPDF_Core_Writer_TempStream

Class hierarchy

Implements

Summary

Properties

$_buffer

protected string TempStreamWriter::$_buffer = ''

$_bufferSize

protected int TempStreamWriter::$_bufferSize = 10000

$_handle

protected resource StreamWriter::$_handle

The file stream resource

$_status

protected string AbstractWriter::$_status = 0

Status property


Methods

__construct()

public TempStreamWriter::__construct (
?int $memoryLimit = null,
int $bufferSize = 10000
)

The constructor.

Parameters
$memoryLimit : ?int

Limit to use before writing to a temporary file. If null PHPs default (2 MB) is used.

$bufferSize : int

The buffer size of which needs to be reached until the data is written to the stream.

__destruct()

public TempStreamWriter::__destruct (
void
): void

The deconstructor closes the file handle.

_flush()

protected TempStreamWriter::_flush (
void
): void

Flushes the buffer to the stream and resets the buffer.

_setHandle()

protected StreamWriter::_setHandle (
resource $handle
): void

Set the stream handle.

Parameters
$handle : resource
 

cleanUp()

public AbstractWriter::cleanUp (
void
): void

Method which should/will be called when the document objects cleanUp() method is called.

copy()

WARNING: This method is marked as deprecated!

Use copyStream() instead.

public StreamWriter::copy (
resource|\SetaPDF_Core_Writer_Stream $source
): void
Parameters
$source : resource|\SetaPDF_Core_Writer_Stream
 

copyStream()

public StreamWriter::copyStream (
resource|\SetaPDF_Core_Writer_Stream $source
): void

Copies an existing stream into the target stream.

Parameters
$source : resource|\SetaPDF_Core_Writer_Stream
 

finish()

public TempStreamWriter::finish (
void
): void

Finish methods flushes the buffer to the stream.

getHandle()

public TempStreamWriter::getHandle (
void
): resource

Gets the handle of the stream.

This method is overwritten to ensure that the handle is only accessed when the writer instance has the status "finished".

getPos()

public TempStreamWriter::getPos (
void
): int

Returns the current position.

getStatus()

public AbstractWriter::getStatus (
void
): string

Get the current status of the writer object.

start()

public AbstractWriter::start (
void
): void

Method which should/will be called when the writing process starts.

write()

public TempStreamWriter::write (
string $s
): void

Write content to the stream or buffer.

Parameters
$s : string