The IO::Buffered
mixin enhances an IO
with input/output buffering.
The buffering behaviour can be turned on/off with the #sync=
and #read_buffering=
methods.
Additionally, several methods, like #gets
, are implemented in a more efficient way.
Return the buffer size used
Set the buffer size of both the read and write buffer Cannot be changed after any of the buffers have been allocated
Flushes and closes the underlying IO
.
Flushes any buffered data and the underlying IO
.
Turns on/off flushing the underlying IO
when a newline is written.
Determines if this IO
flushes automatically when a newline is written.
Returns the bytes hold in the read buffer.
Buffered implementation of IO#read(slice)
.
Turns on/off IO
read buffering.
Determines whether this IO
buffers reads.
Rewinds the underlying IO
.
Turns on/off IO
write buffering.
Determines if this IO
does write buffering.
Closes the wrapped IO
.
Flushes the wrapped IO
.
Reads at most slice.size bytes from the wrapped IO
into slice.
Rewinds the wrapped IO
.
Writes at most slice.size bytes from slice into the wrapped IO
.
Buffered implementation of IO#write(slice)
.
Return the buffer size used
Set the buffer size of both the read and write buffer Cannot be changed after any of the buffers have been allocated
Turns on/off flushing the underlying IO
when a newline is written.
Returns the bytes hold in the read buffer.
This method only performs a read to return peek data if the current buffer is empty: otherwise no read is performed and whatever is in the buffer is returned.
Buffered implementation of IO#read(slice)
.
Reads at most slice.size bytes from the wrapped IO
into slice. Returns the number of bytes read.
Writes at most slice.size bytes from slice into the wrapped IO
. Returns the number of bytes written.
Buffered implementation of IO#write(slice)
.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/IO/Buffered.html