Module: ChupaText::Decomposers::Tar::CopyStreamable

Defined in:
lib/chupa-text/decomposers/tar.rb

Overview

TODO: Supporting output buffer in #read and #readpartial should be done in RubyGems' tar implementation.

Instance Method Summary collapse

Instance Method Details

#readpartial(max_length, buffer = nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/chupa-text/decomposers/tar.rb', line 55

def readpartial(max_length, buffer=nil)
  data = super(max_length)
  if data.nil?
    if max_length.zero?
      return ""
    else
      raise EOFError
    end
  end

  if buffer.nil?
    data
  else
    buffer.replace(data)
    buffer
  end
end