def write(data=nil,headers={})
raise SyntaxException, "No data or header updates supplied" if ((data.nil? && $stdin.tty?) and headers.empty?)
if headers['Content-Type'].nil?
type = MIME::Types.type_for(self.name).first.to_s
if type.empty?
headers['Content-Type'] = "application/octet-stream"
else
headers['Content-Type'] = type
end
end
data = $stdin if (data.nil? && $stdin.tty? == false)
response = self.container.connection.cfreq("PUT",@storagehost,"#{@storagepath}",@storageport,@storagescheme,headers,data)
code = response.code
raise InvalidResponseException, "Invalid content-length header sent" if (code == "412")
raise MisMatchedChecksumException, "Mismatched etag" if (code == "422")
raise InvalidResponseException, "Invalid response code #{code}" unless (code == "201")
make_path(File.dirname(self.name)) if @make_path == true
self.populate
true
end