class
Bakelite::FileIO
- Bakelite::FileIO
- IO
- Reference
- Object
Overview
High-performance, read-only streaming IO implementation for Bakelite stored assets. Decompresses chunks on demand into a single active sliding buffer, ensuring peak memory usage remains strictly O(chunk_size) regardless of file size.
Defined in:
bakelite/file_io.crConstructors
Instance Method Summary
-
#close : Nil
Closes this
IO. -
#closed? : Bool
Returns
trueif thisIOis closed. - #compression : CompressionType
-
#pos : Int64
Returns the current position (in bytes) in this
IO. -
#read(slice : Bytes) : Int32
Reads up to slice.size bytes into slice.
-
#seek(offset : Int, whence : IO::Seek = IO::Seek::Set) : self
Seeking support: Set, Current, or End
- #size : Int64
-
#write(slice : Bytes) : Nil
Writes the contents of slice into this
IO.
Constructor Detail
Instance Method Detail
Closes this IO.
IO defines this is a no-op method, but including types may override.
Returns true if this IO is closed.
IO defines returns false, but including types may override.
Returns the current position (in bytes) in this IO.
The IO class raises on this method, but some subclasses, notable
IO::FileDescriptor and IO::Memory implement it.
File.write("testfile", "hello")
file = File.new("testfile")
file.pos # => 0
file.gets(2) # => "he"
file.pos # => 2
Reads up to slice.size bytes into slice. Returns number of bytes read (0 on EOF).
Seeking support: Set, Current, or End
Writes the contents of slice into this IO.
io = IO::Memory.new
slice = Bytes.new(4) { |i| ('a'.ord + i).to_u8 }
io.write(slice)
io.to_s # => "abcd"