Method: ZipKit::WriteBuffer#initialize
- Defined in:
- lib/zip_kit/write_buffer.rb
#initialize(writable, buffer_size) ⇒ WriteBuffer
Creates a new WriteBuffer bypassing into a given writable object
32 33 34 35 36 37 38 39 40 |
# File 'lib/zip_kit/write_buffer.rb', line 32 def initialize(writable, buffer_size) # Allocating the buffer using a zero-padded String as a variation # on using capacity:, which JRuby apparently does not like very much. The # desire here is that the buffer doesn't have to be resized during the lifetime # of the object. @buf = ("\0".b * (buffer_size * 2)).clear @buffer_size = buffer_size @writable = writable end |