This class staples together two unidirectional IOs 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 IOs.
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 IOs.
If #sync_close? is true, closing this IO will close the underlying IOs.
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 IOs 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 IOs.
Flushes writer.
If #sync_close? is true, closing this IO will close the underlying IOs.
If #sync_close? is true, closing this IO will close the underlying IOs.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/IO/Stapled.html