Methods

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, line 272
def initialize(io, limit)
  @io       = io
  @limit    = limit
  @written  = 0
end

Public Instance Methods

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.