A WriteOnlyStream that also has a size limit.
The maximum number of bytes that may be written to this data stream.
The current total number of bytes written to this data stream.
# File lib/archive/tar/minitar/writer.rb, line 25 def self.const_missing(c) case c when :FileOverflow warn 'Writer::BoundedWriteStream::FileOverflow has been renamed ' 'to Writer::WriteBoundaryOverflow' const_set :FileOverflow, Archive::Tar::Minitar::Writer::WriteBoundaryOverflow else super end end
# File lib/archive/tar/minitar/writer.rb, line 43 def initialize(io, limit) @io = io @limit = limit @written = 0 end
# File lib/archive/tar/minitar/writer.rb, line 49 def write(data) raise WriteBoundaryOverflow if (data.size + @written) > @limit @io.write(data) @written += data.size data.size end