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.

(Note that upstream is closer to the source, and downstream is further away.)

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

Constructors

this
this(OutputStream stream)

Construct a buffer.

this
this(OutputStream stream, size_t capacity)

Construct a buffer.

Members

Aliases

output
alias output = OutputFilter.output
Undocumented in source.

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.

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.

seek
long seek(long offset, Anchor start)

Seek within this stream. Any and all buffered output is disposed before the upstream is invoked. Use an explicit flush() to emit content prior to seeking.

slice
void[] slice()

Retrieve the valid content.

truncate
bool truncate(size_t length)

Truncate buffer content.

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

Emulate OutputStream.write().

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

Write into this buffer.

Properties

limit
size_t limit [@property getter]

Access buffer limit.

output
OutputStream output [@property setter]

Set the output stream.

writable
size_t writable [@property getter]

Available space.

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 [@property getter]

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 [@property getter]

Return the upstream host of this filter.

close
void close()

Close the output.

Meta