def write(data = nil, headers = {})
raise CloudFiles::Exception::Syntax, "No data or header updates supplied" if ((data.nil? && $stdin.tty?) and headers.empty?)
data = $stdin if (data.nil? && $stdin.tty? == false)
begin
response = SwiftClient.put_object(self.container.connection.storageurl, self.container.connection.authtoken, self.container.escaped_name, escaped_name, data, nil, nil, nil, nil, headers)
rescue ClientException => e
code = e.status.to_s
raise CloudFiles::Exception::InvalidResponse, "Invalid content-length header sent" if (code == "412")
raise CloudFiles::Exception::MisMatchedChecksum, "Mismatched etag" if (code == "422")
raise CloudFiles::Exception::InvalidResponse, "Invalid response code #{code}" unless (code =~ /^20./)
end
make_path(File.dirname(self.name)) if @make_path == true
self.refresh
true
end