frost.io

Class MemoryOutputStream

    └ OutputStream
         └ Object

An OutputStream which stores the data written to it in a memory buffer.

Source Code:
View Source

Initializer Summary

init()
Creates a new MemoryOutputStream.
init(capacity:Int)
Creates a new MemoryOutputStream with the specified capacity.
Inherited Fields:

Instance Method Summary

write(i:UInt8):Error?
Writes a single byte.
write(ptr:Pointer<UInt8>, count:Int):Error?
Writes a block of data to this stream.
clear()
Clears all data written to the stream.
finish():String
Invalidates this stream and returns its contents as an immutable String.
Inherited Methods:

Initializers

init ()

Creates a new MemoryOutputStream.

init (capacity:Int)

Creates a new MemoryOutputStream with the specified capacity.

Parameters:
capacity - value of type Int

Instance Methods

@override
method write (i:UInt8
):Error?

Writes a single byte.

Parameters:
i - value of type UInt8
Overrides:
frost.io.OutputStream.write
@override
method write (ptr:Pointer<UInt8>,
 count:Int
):Error?

Writes a block of data to this stream.

Parameters:
ptr - Pointer to the data to write
count - number of bytes to write
Overrides:
frost.io.OutputStream.write
method clear ()

Clears all data written to the stream.

method finish ():String

Invalidates this stream and returns its contents as an immutable String. This is generally preferable to toString, as it does not copy the stream's contents. Interacting in any way with a MemoryOutputStream after finishing it will cause precondition violations (or, if safety checks are disabled, undefined behavior).