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
278 def initialize(io, limit)
279   @io       = io
280   @limit    = limit
281   @written  = 0
282 end

Public Instance Methods

write(data) click to toggle source
    # File lib/archive/tar/minitar.rb
284 def write(data)
285   raise FileOverflow if (data.size + @written) > @limit
286   @io.write(data)
287   @written += data.size
288   data.size
289 end