A Reader that is linked with a Writer and close
-ing
is synchronous.
A Reader that is linked with a Writer and close
-ing
is synchronous.
Just as with readers and writers,
only one outstanding read
or write
is permitted.
For a proper close
, it should only be done when
no writes are outstanding:
val rw = Reader.writable()
...
rw.write(buf).before(rw.close())
If a producer is interested in knowing when all writes
have been read and the reader has seen the EOF, it can
wait until the future returned by close()
is satisfied:
val rw = Reader.writable() ... rw.close().ensure { println("party on! ♪┏(・o・)┛♪ the Reader has seen the EOF") }
Convenient abstraction to read from a stream of Readers as if it were a single Reader.
Copy the bytes from a Reader to a Writer in chunks of size
Writer.BufferSize
.
Copy the bytes from a Reader to a Writer in chunks of size
Writer.BufferSize
. The Writer is unmanaged, the caller is responsible
for finalization and error handling, e.g.:
Reader.copy(r, w) ensure w.close()
Copy the bytes from a Reader to a Writer in chunks of size n
.
Copy the bytes from a Reader to a Writer in chunks of size n
. The Writer
is unmanaged, the caller is responsible for finalization and error
handling, e.g.:
Reader.copy(r, w, n) ensure w.close()
The number of bytes to read on each refill of the Writer.
Copy bytes from many Readers to a Writer.
Copy bytes from many Readers to a Writer. The Writer is unmanaged, the caller is responsible for finalization and error handling, e.g.:
Reader.copyMany(readers, writer) ensure writer.close()
Copy bytes from many Readers to a Writer.
Copy bytes from many Readers to a Writer. The Writer is unmanaged, the caller is responsible for finalization and error handling, e.g.:
Reader.copyMany(readers, writer) ensure writer.close()
The number of bytes to read each time.
Reader from a Buf.
Create a new Reader for a File
.
Wrap InputStream
with a Reader.
Wrap InputStream
with a Reader.
Note that the given InputStream
will be closed
on reading of EOF and Reader.discard().
Readers.fromStream
for a Java API
Read the entire bytestream presented by r
.
Create a new Writable which is a Reader that is linked with a Writer.