Class: Microsandbox::FsWriteSink
- Inherits:
-
Object
- Object
- Microsandbox::FsWriteSink
- Defined in:
- lib/microsandbox/fs.rb
Overview
A streaming writer to a guest file, from Microsandbox::FS#write_stream.
Instance Method Summary collapse
-
#close ⇒ nil
Flush and close the sink.
-
#initialize(native) ⇒ FsWriteSink
constructor
A new instance of FsWriteSink.
-
#write(data) ⇒ self
Write a chunk of bytes.
Constructor Details
#initialize(native) ⇒ FsWriteSink
Returns a new instance of FsWriteSink.
233 234 235 |
# File 'lib/microsandbox/fs.rb', line 233 def initialize(native) @native = native end |
Instance Method Details
#close ⇒ nil
Flush and close the sink. Idempotent.
249 250 251 252 |
# File 'lib/microsandbox/fs.rb', line 249 def close @native.close nil end |
#write(data) ⇒ self
Write a chunk of bytes.
241 242 243 244 245 |
# File 'lib/microsandbox/fs.rb', line 241 def write(data) bytes = Microsandbox.coerce_write_bytes(data) @native.write(bytes) self end |