lib/openstack/swift/storage_object.rb
def data(size = -1, offset = 0, headers = {})
      headers = {'content-type'=>'application/json'}
      if size.to_i > 0
        range = sprintf("bytes=%d-%d", offset.to_i, (offset.to_i + size.to_i) - 1)
        headers['Range'] = range
      end
      path = "/#{@containername}/#{@name}"
      begin
        response = @container.swift.connection.req("GET", URI.encode(path), {:headers=>headers})
        response.body
      rescue OpenStack::Exception::ItemNotFound => not_found
        msg = "No Object \"#{@name}\" found in Container \"#{@containername}\".  #{not_found.message}"
        raise OpenStack::Exception::ItemNotFound.new(msg, not_found.response_code, not_found.response_body)
      end
    end
# Retrieves the data from an object and stores the data in memory.  The data is returned as a string.
# Throws a OpenStack::Exception::ItemNotFound if the object doesn't exist.
#
# If the optional size and range arguments are provided, the call will return the number of bytes provided by
# size, starting from the offset provided in offset.
#
#   object.data
#   => "This is the text stored in the file"
Retrieves the data from an object and stores the data in memory.  The data is returned as a string.
Throws a OpenStack::Exception::ItemNotFound if the object doesn't exist.

If the optional size and range arguments are provided, the call will return the number of bytes provided by
size, starting from the offset provided in offset.

object.data
> "This is the text stored in the file"
Retrieves the data from an object and stores the data in memory . The data is returned as a string . Throws a OpenStack :: Exception :: ItemNotFound if the object doesn ' t exist . If the optional size and range arguments are provided the call will return the number of bytes provided by size starting from the offset provided in offset . object . data > " This is the text stored in the file "
def data(size = -1, offset = 0, headers = {})
      headers = {'content-type'=>'application/json'}
      if size.to_i > 0
        range = sprintf("bytes=%d-%d", offset.to_i, (offset.to_i + size.to_i) - 1)
        headers['Range'] = range
      end
      path = "/#{@containername}/#{@name}"
      begin
        response = @container.swift.connection.req("GET", URI.encode(path), {:headers=>headers})
        response.body
      rescue OpenStack::Exception::ItemNotFound => not_found
        msg = "No Object \"#{@name}\" found in Container \"#{@containername}\".  #{not_found.message}"
        raise OpenStack::Exception::ItemNotFound.new(msg, not_found.response_code, not_found.response_body)
      end
    end
def data ( size = - 1 , offset = 0 , headers = { } ) headers = { 'content-type' => 'application/json' } if size . to_i > 0 range = sprintf ( "bytes=%d-%d" , offset . to_i , ( offset . to_i + size . to_i ) - 1 ) headers [ 'Range' ] = range end path = "/#{@containername}/#{@name}" begin response = @container . swift . connection . req ( "GET" , URI . encode ( path ) , { :headers => headers } ) response . body rescue OpenStack :: Exception :: ItemNotFound => not_found msg = "No Object \"#{@name}\" found in Container \"#{@containername}\".  #{not_found.message}" raise OpenStack :: Exception :: ItemNotFound . new ( msg , not_found . response_code , not_found . response_body ) end end
Retrieves the data from an object and stores the data in memory.
Retrieves the data from an object and stores the data in memory .
size
offset
headers