us.monoid.web
Class BinaryResource

java.lang.Object
  extended by us.monoid.web.Resty
      extended by us.monoid.web.AbstractResource
          extended by us.monoid.web.BinaryResource

public class BinaryResource
extends AbstractResource

All-purpose resource which is used to access application/octet-stream content or any content in that respect. I.e. it will match all types, so you can also download raw JSON or images or whatever media type you envision.

Author:
beders

Nested Class Summary
 
Nested classes/interfaces inherited from class us.monoid.web.Resty
Resty.Option, Resty.Proxy, Resty.Timeout
 
Constructor Summary
BinaryResource(Resty.Option... options)
           
 
Method Summary
 File save(File aFileName)
          Save the contents of the resource to a file.
 
Methods inherited from class us.monoid.web.AbstractResource
getUrlConnection, http, location, status, stream
 
Methods inherited from class us.monoid.web.Resty
alwaysSend, authenticate, authenticate, authenticateForRealm, bytes, bytes, bytes, bytes, content, content, content, data, data, delete, dontSend, enc, form, form, identifyAsMozilla, identifyAsResty, ignoreAllCerts, json, json, json, json, path, put, setOptions, setProxy, text, text, text, text, withHeader, xml, xml, xml, xml, xpath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryResource

public BinaryResource(Resty.Option... options)
Method Detail

save

public File save(File aFileName)
          throws IOException
Save the contents of the resource to a file. This reads the data from the stream and stores it into the given file. Depending on the resource the data might or might not be available afterwards.

Parameters:
aFileName - file to save the data in
Returns:
the file the content was stored at
Throws:
IOException


Copyright © 2013. All Rights Reserved.