Home

fillbuf

Fillbuf is a term used in programming to describe a routine that fills a pre-allocated buffer with data from a source. It appears in low-level I/O code, data streaming libraries, and various language runtimes. Because it is not a formal standard, the exact interface and semantics differ between languages and frameworks; however, the core idea is to move data into a buffer so that subsequent processing can proceed without further source queries during the fill operation.

Common behavior: A fillbuf operation accepts a pointer (or reference) to a memory buffer and a target

Context and usage: In file I/O, a fillbuf call may replenish an in-memory cache from a disk

See also: Read, Readinto, Buffer, Buffering, Refill.

size,
and
returns
the
number
of
bytes
actually
filled.
It
may
block
until
data
becomes
available
or
return
immediately
to
indicate
that
no
data
was
currently
obtainable.
If
the
underlying
source
can
provide
only
a
partial
amount
rather
than
the
full
request,
fillbuf
will
either
loop
internally
to
complete
the
request
or
report
the
partial
fill
to
the
caller
along
with
an
indication
of
whether
more
data
is
expected.
Robust
implementations
distinguish
between
end-of-file/end-of-stream
and
error
conditions.
file.
In
network
programming,
it
often
refills
the
input
buffer
from
a
socket
as
data
arrives.
In
asynchronous
or
non-blocking
environments,
fillbuf
is
usually
integrated
with
event
loops
or
futures
to
avoid
blocking
the
main
thread.
Some
languages
expose
similar
concepts
under
different
names,
such
as
readinto
or
transfer-to-buffer.