def self.create(container, objectname, headers={}, data=nil)
provided_headers = (headers[:metadata] || {}).inject({}){|res, (k,v)| ((k.to_s.match /^X-Object-Meta-/i) ? res[k.to_s]=v : res["X-Object-Meta-#{k.to_s}"]=v) ;res}
provided_headers["content-type"] = headers[:content_type] unless headers[:content_type].nil?
provided_headers["ETag"] = headers[:etag] unless headers[:etag].nil?
provided_headers["Cache-Control"] = headers[:cache_control] unless headers[:cache_control].nil?
provided_headers["X-Object-Manifest"] = headers[:manifest] unless headers[:manifest].nil?
if data.nil?
path = "/#{container.name}/#{objectname}"
provided_headers["content-length"] = "0"
container.swift.connection.req("PUT", URI.encode(path), {:headers=>provided_headers})
else
self.new(container, objectname).write(data, provided_headers)
end
self.new(container, objectname)
end