class IO::Stream::Generic
Base class for stream implementations providing common functionality.
def close
def close return if closed? begin self.flush rescue # We really can't do anything here unless we want #close to raise exceptions. ensure self.sysclose end end
def closed?
Check if the stream is closed.
def closed? false end
def initialize(**options)
Initialize a new generic stream.
def initialize(**options) super(**options) end
def sysclose
Closes the underlying IO stream.
def sysclose raise NotImplementedError end
def sysread(size, buffer)
Reads data from the underlying stream as efficiently as possible.
def sysread(size, buffer) raise NotImplementedError end
def syswrite(buffer)
@parameter buffer [String] The data to write.
This method should be implemented by subclasses to handle the specific writing logic.
Writes data to the underlying stream.
def syswrite(buffer) raise NotImplementedError end