Skip to content

BufferedOutput

Hyomoto edited this page Jun 24, 2021 · 1 revision
Jump To Go Back Arguments Methods Variables

BufferedOutput( output, size )

Implements: OutputStream

Buffered output is an output stream that will hold the outputs passed to it until it reaches a certain size, at which the outputs will be written to the provided output stream. This can be used, for example, to collect a bunch of log entries and write them all at once. If size is 0, the buffer will not be emptied until write_to_output is called. If output is not an OutputStream or size is not a number, InvalidArgumentType will be thrown.

var _output	= new BufferedOutput( new TextFile().open( "log.txt", FAST_FILE_OPEN_NEW ), 10 );

var _i = 0; repeat( 18 ) { _output.write( _i++, "\n" ); }
Output: 0-9 will be written to the text file, and 10-17 will remain in the buffer until more entries are buffered or the output is closed

Arguments

Name Type Purpose
output [__OutputStream__](__outputstream__) The output stream to buffer to
size int The size at which the buffer should write

Methods

Jump To top write close buffer write_to_output

write( )

Name Type Purpose
None

No description.


close( )

Name Type Purpose
None

No description.


buffer( )

Name Type Purpose
None

No description.


write_to_output( )

Name Type Purpose
None

No description.


Variables

Jump To top
Name Type Initial Purpose
__Output undef _output No description.
__Length undef max( 1, floor( _size )) No description.
__Buffer undef array_create( _size ) No description.
__Index undef 0 No description.
Clone this wiki locally