Class: OpenStack::Swift::ChunkedConnectionWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/openstack/swift/connection.rb

Overview

used for PUT object with body_stream for http data see OpenStack::Connection::put_object

Instance Method Summary collapse

Constructor Details

#initialize(data, chunk_size) ⇒ ChunkedConnectionWrapper

Returns a new instance of ChunkedConnectionWrapper.



166
167
168
169
# File 'lib/openstack/swift/connection.rb', line 166

def initialize(data, chunk_size)
  @size = chunk_size
  @file = data
end

Instance Method Details

#eof!Object



181
182
183
# File 'lib/openstack/swift/connection.rb', line 181

def eof!
  @file.eof!
end

#eof?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/openstack/swift/connection.rb', line 184

def eof?
  @file.eof?
end

#read(length = nil, buffer = nil) ⇒ Object

for ruby 2.x



172
173
174
175
176
177
178
179
# File 'lib/openstack/swift/connection.rb', line 172

def read(length=nil, buffer=nil)
  if buffer.nil?
    chunk = @file.read(length)
  else
    chunk = @file.read(length, buffer)
  end
  chunk
end