BufferedInput

Buffers the flow of data from a upstream input

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

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

Constructors

this
this(InputStream stream)

Construct a buffer.

this
this(InputStream stream, size_t capacity)

Construct a buffer.

Members

Aliases

clear
alias clear = flush

Clear/flush are the same

input
alias input = InputFilter.input

Access the source.

Functions

capacity
size_t capacity()

Access buffer capacity.

compress
BufferedInput compress()

Compress buffer space.

drain
size_t drain(OutputStream dst)

Drain buffer content to the specific conduit.

fill
size_t fill(void[] dst, bool exact)

Fill the provided buffer

flush
BufferedInput flush()

Clear buffer content.

input
void input(InputStream source)

Set the input stream.

limit
size_t limit()

Access buffer limit.

load
void[] load(size_t max)

Load the bits from a stream, up to an indicated length, and return them all in an array.

next
bool next(size_t delegate(const(void)[]) scan)

Iterator support.

opSlice
void[] opSlice(size_t start, size_t end)
populate
size_t populate()

Place more data from the source stream into this buffer, and returns the number of bytes added.

position
size_t position()

Access buffer read position.

read
size_t read(void[] dst)

Transfer content into the provided dst.

readable
size_t readable()

Available content.

reader
size_t reader(size_t delegate(const(void)[]) dg)

Read directly from this buffer.

reserve
size_t reserve(size_t space)

Reserve the specified space within the buffer, compressing existing content as necessary to make room.

seek
long seek(long offset, Anchor start)

Move the current read location.

skip
bool skip(int size)

Move the current read location.

slice
void[] slice()

Retrieve the valid content.

slice
void[] slice(size_t size, bool eat)

Access buffer content.

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

Write into this buffer.

Static functions

convert
inout(T)[] convert(inout(void)[] x)

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

create
InputBuffer create(InputStream stream)

Attempt to share an upstream Buffer, and create an instance where there's not one available.

Inherited Members

From InputFilter

source
InputStream source;
Undocumented in source.
conduit
IConduit conduit()

Return the hosting conduit.

read
size_t read(void[] dst)

Read from conduit into a target array. The provided dst will be populated with content from the conduit.

load
void[] load(size_t max)

Load the bits from a stream, and return them all in an array. The dst array can be provided as an option, which will be expanded as necessary to consume the input.

flush
IOStream flush()

Clear any buffered content.

seek
long seek(long offset, Anchor anchor)

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

input
InputStream input()

Return the upstream host of this filter.

close
void close()

Close the input.

Meta