Method: LibGems::Package::TarWriter::BoundedStream#write

Defined in:
lib/libgems/package/tar_writer.rb

#write(data) ⇒ Object

Writes data onto the IO, raising a FileOverflow exception if the number of bytes will be more than #limit



42
43
44
45
46
47
48
49
# File 'lib/libgems/package/tar_writer.rb', line 42

def write(data)
  if data.size + @written > @limit
    raise FileOverflow, "You tried to feed more data than fits in the file."
  end
  @io.write data
  @written += data.size
  data.size
end