Crystal::EventLoop::FileDescriptor - Crystal 1.16.3

# module Crystal::EventLoop::FileDescriptor

##
Direct including types

- Crystal::EventLoop

##
Defined in:

crystal/event_loop/file_descriptor.cr

##
Instance Method Summary

- #close(file_descriptor : Crystal::System::FileDescriptor) : Nil

  Closes the file descriptor resource.

- #read(file_descriptor : Crystal::System::FileDescriptor, slice : Bytes) : Int32

  Reads at least one byte from the file descriptor into slice.

- #wait_readable(file_descriptor : Crystal::System::FileDescriptor) : Nil

  Blocks the current fiber until the file descriptor is ready for read.

- #wait_writable(file_descriptor : Crystal::System::FileDescriptor) : Nil

  Blocks the current fiber until the file descriptor is ready for write.

- #write(file_descriptor : Crystal::System::FileDescriptor, slice : Bytes) : Int32

  Writes at least one byte from slice to the file descriptor.

##
Instance Method Detail

abstract def close(file_descriptor : Crystal::System::FileDescriptor) : Nil #

Closes the file descriptor resource.

abstract def read(file_descriptor : Crystal::System::FileDescriptor, slice : Bytes) : Int32 #

Reads at least one byte from the file descriptor into slice.

Blocks the current fiber if no data is available for reading, continuing when available. Otherwise returns immediately.

Returns the number of bytes read (up to `slice.size`). Returns 0 when EOF is reached.

abstract def wait_readable(file_descriptor : Crystal::System::FileDescriptor) : Nil #

Blocks the current fiber until the file descriptor is ready for read.

abstract def wait_writable(file_descriptor : Crystal::System::FileDescriptor) : Nil #

Blocks the current fiber until the file descriptor is ready for write.

abstract def write(file_descriptor : Crystal::System::FileDescriptor, slice : Bytes) : Int32 #

Writes at least one byte from slice to the file descriptor.

Blocks the current fiber if the file descriptor isn't ready for writing, continuing when ready. Otherwise returns immediately.

Returns the number of bytes written (up to `slice.size`).