C# Class Pchp.Core.BufferedOutput

Inheritance: System.IO.TextWriter
Exibir arquivo Open project: iolevel/peachpie Class Usage Examples

Public Methods

Method Description
BufferedOutput ( bool enableBuffering, TextWriter charSink, Stream byteSink, Encoding encoding ) : System

Creates buffered output with specified sinks.

Clean ( ) : void

Discards data on the current level of buffering.

DecreaseLevel ( bool flush ) : int

Destroys the top level of buffering.

Returns the current level index after decreasing.

FindLevelByFilter ( Delegate filter ) : int

Find level index by the filter callback.

Flush ( ) : void

Flushes data on current level of buffering to sinks or to the previous level and discards them.

FlushAll ( ) : void

Flushes all data from all buffers to sinks. Discards all data and all levels of buffering. Disables output buffering.

GetContent ( ) : PhpValue

Gets a content of buffers on current buffering level.

GetContentAsString ( ) : string

Gets a content of buffers on current buffering level converted to string regardless of its type.

GetFilter ( ) : Delegate

Gets the filtering callback defined on the current level of buffering.

GetFilter ( int levelIndex ) : Delegate

Gets the filtering callback defined on the specified level of buffering.

GetLevelInfo ( int levelIndex, Delegate &filter, int &size ) : void

Gets some information about a specified level.

GetLevelName ( int levelIndex ) : string

Get the name of the level. If the level name is null, the filter.ToString() is used.

IncreaseLevel ( ) : int

Adds a new level of buffering on the top of the levels stack.

Returns the new level index.

SetFilter ( Delegate filter ) : void

Assignes the filtering callback to the current level of buffering.

Data are filtered when flushed.

SetFilter ( Delegate filter, int levelIndex ) : void

Assignes the filtering callback to the specified level of buffering.

Data are filtered when flushed.

SetLevelName ( int levelIndex, string levelName ) : void

Set the level name.

SetUserData ( object data ) : void

Assignes the arbitrary data to the current level of buffering.

Data are filtered when flushed.

SetUserData ( object data, int levelIndex ) : void

Assignes an arbitrary data to the specified level of buffering.

Data are filtered when flushed.

ThrowIfDisabled ( ) : void

Checks output buffer is not disabled.

Write ( char value ) : void

Writes a subarray of characters to the output buffer.

Write ( char value, int index, int count ) : void

Writes a subarray of characters to the output buffer.

Write ( string value ) : void

Writes a string value to the output buffer.

WriteBytes ( byte value ) : void

Writes an array of bytes to the output buffer.

WriteBytes ( byte value, int index, int count ) : void

Writes a subarray of bytes to the output buffer.

Private Methods

Method Description
AllocateBuffer ( int sizeNeeded, bool binary, System &buffer, int &position ) : int

Gets a buffer where data of requested size and type can be stored.

The buffer may already exist or new one may be created. Works on the current level of buffering.

InternalFlush ( ) : void

Flushes data on current level of buffering to the sinks or to the previous level. The current level clean up MUST follow this method's call.

WriteInternal ( Array value, bool binary, int index, int count ) : void

Writes a subarray to the output buffer.

Method Details

BufferedOutput() public method

Creates buffered output with specified sinks.
public BufferedOutput ( bool enableBuffering, TextWriter charSink, Stream byteSink, Encoding encoding ) : System
enableBuffering bool Whether to immediately enable buffering, i.e. increase the level.
charSink System.IO.TextWriter A writer through which character data will be written.
byteSink Stream A stream through which binary data will be written.
encoding System.Text.Encoding A encoding used to transform binary data to strings.
return System

Clean() public method

Discards data on the current level of buffering.
public Clean ( ) : void
return void

DecreaseLevel() public method

Destroys the top level of buffering.
Returns the current level index after decreasing.
public DecreaseLevel ( bool flush ) : int
flush bool Whether to flush data on the current level. Data will be discarded if not set.
return int

FindLevelByFilter() public method

Find level index by the filter callback.
public FindLevelByFilter ( Delegate filter ) : int
filter System.Delegate
return int

Flush() public method

Flushes data on current level of buffering to sinks or to the previous level and discards them.
public Flush ( ) : void
return void

FlushAll() public method

Flushes all data from all buffers to sinks. Discards all data and all levels of buffering. Disables output buffering.
public FlushAll ( ) : void
return void

GetContent() public method

Gets a content of buffers on current buffering level.
public GetContent ( ) : PhpValue
return PhpValue

GetContentAsString() public method

Gets a content of buffers on current buffering level converted to string regardless of its type.
public GetContentAsString ( ) : string
return string

GetFilter() public method

Gets the filtering callback defined on the current level of buffering.
Output buffering is disabled.
public GetFilter ( ) : Delegate
return System.Delegate

GetFilter() public method

Gets the filtering callback defined on the specified level of buffering.
is out of range.
public GetFilter ( int levelIndex ) : Delegate
levelIndex int The level of buffering which the filter to associate with.
return System.Delegate

GetLevelInfo() public method

Gets some information about a specified level.
public GetLevelInfo ( int levelIndex, Delegate &filter, int &size ) : void
levelIndex int Level index starting from 1.
filter System.Delegate Filtering callback (if any).
size int Data size.
return void

GetLevelName() public method

Get the name of the level. If the level name is null, the filter.ToString() is used.
public GetLevelName ( int levelIndex ) : string
levelIndex int Index of the level from 1.
return string

IncreaseLevel() public method

Adds a new level of buffering on the top of the levels stack.
Returns the new level index.
public IncreaseLevel ( ) : int
return int

SetFilter() public method

Assignes the filtering callback to the current level of buffering.
Data are filtered when flushed.
Output buffering is disabled.
public SetFilter ( Delegate filter ) : void
filter System.Delegate The filter. Null reference means no filter.
return void

SetFilter() public method

Assignes the filtering callback to the specified level of buffering.
Data are filtered when flushed.
is out of range.
public SetFilter ( Delegate filter, int levelIndex ) : void
filter System.Delegate The filter. Null reference means no filter.
levelIndex int The level of buffering which the filter to associate with.
return void

SetLevelName() public method

Set the level name.
public SetLevelName ( int levelIndex, string levelName ) : void
levelIndex int Index of the level from 1.
levelName string New name of the level.
return void

SetUserData() public method

Assignes the arbitrary data to the current level of buffering.
Data are filtered when flushed.
public SetUserData ( object data ) : void
data object The reference to data.
return void

SetUserData() public method

Assignes an arbitrary data to the specified level of buffering.
Data are filtered when flushed.
public SetUserData ( object data, int levelIndex ) : void
data object Null reference clears assigned data.
levelIndex int The level of buffering which the filter to associate with.
return void

ThrowIfDisabled() public method

Checks output buffer is not disabled.
When buffering is disabled ( is null).
public ThrowIfDisabled ( ) : void
return void

Write() public method

Writes a subarray of characters to the output buffer.
public Write ( char value ) : void
value char Characters to be written.
return void

Write() public method

Writes a subarray of characters to the output buffer.
public Write ( char value, int index, int count ) : void
value char The value to be written.
index int Starting index in the array.
count int The number of characters to write.
return void

Write() public method

Writes a string value to the output buffer.
public Write ( string value ) : void
value string The value to be written.
return void

WriteBytes() public method

Writes an array of bytes to the output buffer.
public WriteBytes ( byte value ) : void
value byte Bytes to be written.
return void

WriteBytes() public method

Writes a subarray of bytes to the output buffer.
public WriteBytes ( byte value, int index, int count ) : void
value byte Bytes to be written.
index int Starting index in the array.
count int The number of characters to write.
return void