class Archive::Tar::Minitar::Writer::BoundedStream

A RestrictedStream that also has a size limit.

Attributes

limit[R]

The maximum number of bytes that may be written to this data stream.

written[R]

The current total number of bytes written to this data stream.

Public Class Methods

new(io, limit) click to toggle source
    # File lib/archive/tar/minitar.rb
272 def initialize(io, limit)
273   @io       = io
274   @limit    = limit
275   @written  = 0
276 end

Public Instance Methods

write(data) click to toggle source
    # File lib/archive/tar/minitar.rb
278 def write(data)
279   raise FileOverflow if (data.size + @written) > @limit
280   @io.write(data)
281   @written += data.size
282   data.size
283 end