Class: ADSP::Test::Mock::File
Overview
ADSP::Test::Mock::File class.
Constant Summary collapse
- PORTION_LENGTH =
10**6
Constants inherited from File
File::BUFFER_LENGTH_NAMES, File::Option
Class Method Summary collapse
- .native_compress_io(source_io, destination_io, options) ⇒ Object
- .native_decompress_io(source_io, destination_io, options) ⇒ Object
Methods inherited from File
Class Method Details
.native_compress_io(source_io, destination_io, options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/adsp/test/mock/file.rb', line 15 def self.native_compress_io(source_io, destination_io, ) destination_buffer_length = [:destination_buffer_length] source = "".b loop do begin source << source_io.readpartial(PORTION_LENGTH) rescue ::EOFError break end until source.empty? data, bytes_read = Common.native_compress source, destination_buffer_length source = source.byteslice bytes_read, source.bytesize - bytes_read destination_io.write data end end nil end |
.native_decompress_io(source_io, destination_io, options) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/adsp/test/mock/file.rb', line 37 def self.native_decompress_io(source_io, destination_io, ) destination_buffer_length = [:destination_buffer_length] source = "".b loop do begin source << source_io.readpartial(PORTION_LENGTH) rescue ::EOFError break end until source.empty? data, bytes_read = Common.native_decompress source, destination_buffer_length source = source.byteslice bytes_read, source.bytesize - bytes_read destination_io.write data end end nil end |