class NGHTTP::TransparentIO
- NGHTTP::TransparentIO
- IO
- Reference
- Object
Defined in:
nghttp/io/transparent_io.crConstructors
Instance Method Summary
-
#close
Closes this
IO
. - #close_underlying_io : Bool
- #close_underlying_io=(close_underlying_io : Bool)
- #debug_hex
-
#flush
Flushes buffered data, if any.
- #io : IO
- #io=(io : IO)
- #on_close(&b : Closer)
- #on_close=(v : Nil)
- #on_read(&b : Bytes, Int32 | Int64 -> )
- #on_read=(v : Nil)
- #on_write(&b : Bytes -> )
- #on_write=(v : Nil)
-
#peek
Peeks into this IO, if possible.
-
#read(slice : Bytes)
Reads at most slice.size bytes from this
IO
into slice. -
#rewind
Rewinds this
IO
. -
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #wait_readable(t)
-
#write(slice : Bytes) : Nil
Writes the contents of slice into this
IO
.
Instance methods inherited from class IO
pack(spec, *a)
pack,
reunpack(src, dst, *vars)
reunpack,
unpack(spec)
unpack
Constructor Detail
Instance Method Detail
Closes this IO
.
IO
defines this is a no-op method, but including types may override.
Flushes buffered data, if any.
IO
defines this is a no-op method, but including types may override.
Peeks into this IO, if possible.
It returns:
nil
if this IO isn't peekable at this moment or at all- an empty slice if it is, but EOF was reached
- a non-empty slice if some data can be peeked
The returned bytes are only valid data until a next call to any method that reads from this IO is invoked.
By default this method returns nil
, but IO implementations
that provide buffering or wrap other IOs should override
this method.
Reads at most slice.size bytes from this IO
into slice.
Returns the number of bytes read, which is 0 if and only if there is no
more data to read (so checking for 0 is the way to detect end of file).
io = IO::Memory.new "hello"
slice = Bytes.new(4)
io.read(slice) # => 4
slice # => Bytes[104, 101, 108, 108]
io.read(slice) # => 1
slice # => Bytes[111, 101, 108, 108]
io.read(slice) # => 0
Rewinds this IO
. By default this method raises, but including types
may implement it.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Returns a nicely readable and concise string representation of this object, typically intended for users.
This method should usually not be overridden. It delegates to
#to_s(IO)
which can be overridden for custom implementations.
Also see #inspect
.