BufferedOutput

Buffers the flow of data from a upstream output.

A downstream neighbour can locate and use this buffer instead of creating another instance of their own.

Don't forget to flush() buffered content before closing.

Note: upstream is closer to the source, and downstream is further away

Constructors

this
this(OutputStream stream, void delegate() flush_notifier)

Construct a Buffer upon the provided input stream.

this
this(OutputStream stream, size_t capacity, void delegate() flush_notifier)

Construct a Buffer upon the provided input stream.

Members

Aliases

output
alias output = OutputFilter.output

access the sink

Functions

append
BufferedOutput append(const(void)[] src)

Append content.

append
BufferedOutput append(const(void)* src, size_t length)

Append content.

capacity
size_t capacity()

Access buffer capacity.

clear
BufferedOutput clear()

Clear buffer content.

close
void close()

Flushes the buffer and closes the stream.

copy
BufferedOutput copy(InputStream src, size_t max)

Copy content via this buffer from the provided src conduit.

drain
size_t drain(OutputStream dst)

Drain buffer content to the specific conduit.

flush
BufferedOutput flush()

Flush all buffer content to the specific conduit.

limit
size_t limit()

Access buffer limit.

output
void output(OutputStream sink)

Set the output stream.

seek
long seek(long offset, Anchor start)

Seek within this stream

slice
void[] slice()

Retrieve the valid content.

truncate
bool truncate(size_t length)

Truncate the buffer within its extent.

writable
size_t writable()

Available space.

write
size_t write(const(void)[] src)

Emulate OutputStream.write().

writer
size_t writer(size_t delegate(void[]) dg)

Write into this buffer.

Static functions

convert
T[] convert(void[] x)

Cast to a target type without invoking the wrath of the runtime checks for misalignment. Instead, we truncate the array length.

create
OutputBuffer create(OutputStream stream)

Attempts to share an upstream BufferedOutput, and creates a new instance where there's not a shared one available.

Inherited Members

From OutputFilter

sink
OutputStream sink;
Undocumented in source.
conduit
IConduit conduit()

Return the hosting conduit.

write
size_t write(const(void)[] src)

Write to conduit from a source array. The provided src content will be written to the conduit.

copy
OutputStream copy(InputStream src, size_t max)

Transfer the content of another conduit to this one. Returns a reference to this class, or throws IOException on failure.

flush
IOStream flush()

Emit/purge buffered content.

seek
long seek(long offset, Anchor anchor)

Seek on this stream. Target conduits that don't support seeking will throw an IOException.

output
OutputStream output()

Return the upstream host of this filter.

close
void close()

Close the output.

Meta