This class staples together two unidirectional IO
s to form a single, bidirectional IO
.
Example (loopback):
io = IO::Stapled.new(*IO.pipe) io.puts "linus" io.gets # => "linus"
Most methods simply delegate to the underlying IO
s.
Creates a new IO::Stapled
which reads from reader and writes to writer.
Creates a pair of bidirectional pipe endpoints connected with each other and passes them to the given block.
Creates a pair of bidirectional pipe endpoints connected with each other and returns them in a Tuple
.
Closes this IO
.
Returns true
if this IO
is closed.
Flushes writer
.
Gets a string from reader
.
Peeks into reader
.
Reads a slice from reader
.
Reads a single byte from reader
.
Skips reader
.
Skips reader
.
If #sync_close?
is true
, closing this IO
will close the underlying IO
s.
If #sync_close?
is true
, closing this IO
will close the underlying IO
s.
Writes a slice to writer
.
Writes a byte to writer
.
IO
IO
Reference
Reference
Object
Object
Creates a new IO::Stapled
which reads from reader and writes to writer.
Creates a pair of bidirectional pipe endpoints connected with each other and passes them to the given block.
Both endpoints and the underlying IO
s are closed after the block (even if #sync_close?
is false
).
Creates a pair of bidirectional pipe endpoints connected with each other and returns them in a Tuple
.
Closes this IO
.
If #sync_close?
is true
, it will also close the underlying IO
s.
Flushes writer
.
If #sync_close?
is true
, closing this IO
will close the underlying IO
s.
If #sync_close?
is true
, closing this IO
will close the underlying IO
s.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/IO/Stapled.html