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.
238 239 240 |
# File 'lib/microsandbox/fs.rb', line 238 def initialize(native) @native = native end |
Instance Method Details
#close ⇒ nil
Flush and close the sink. Idempotent.
254 255 256 257 |
# File 'lib/microsandbox/fs.rb', line 254 def close @native.close nil end |
#write(data) ⇒ self
Write a chunk of bytes.
246 247 248 249 250 |
# File 'lib/microsandbox/fs.rb', line 246 def write(data) bytes = Microsandbox.coerce_write_bytes(data) @native.write(bytes) self end |