Package com.cloudofficeprint
Class Response
- java.lang.Object
-
- com.cloudofficeprint.Response
-
public class Response extends java.lang.Object
Class for dealing with the Cloud Office Print server's response to a printjob request.
-
-
Constructor Summary
Constructors Constructor Description Response(java.lang.String ext, java.lang.String mimetype, byte[] body)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
asString()
Return the string representation of this Response.void
downloadLocally(java.lang.String path)
Downloads the file locally to the given path, filename needs to be specified at the end of the path, not the extension.byte[]
getBody()
java.lang.String
getExt()
java.lang.String
getMimetype()
void
setBody(byte[] body)
void
setExt(java.lang.String ext)
void
setMimetype(java.lang.String mimetype)
-
-
-
Method Detail
-
getMimetype
public java.lang.String getMimetype()
- Returns:
- mimetype of the file in the body.
-
setMimetype
public void setMimetype(java.lang.String mimetype)
- Parameters:
mimetype
- of the file in the body.
-
getBody
public byte[] getBody()
- Returns:
- body (file base64) of the response.
-
setBody
public void setBody(byte[] body)
- Parameters:
body
- (file base64) of the response.
-
getExt
public java.lang.String getExt()
- Returns:
- extension of the file in the body.
-
setExt
public void setExt(java.lang.String ext)
- Parameters:
ext
- Extension of the file in the body.
-
asString
public java.lang.String asString() throws java.lang.Exception
Return the string representation of this Response. Useful if the server returns a JSON (e.g. for output_type 'count_tags').- Returns:
- string representation of this Response
- Throws:
java.lang.Exception
- if the byte-array cannot be decoded
-
downloadLocally
public void downloadLocally(java.lang.String path) throws java.io.IOException
Downloads the file locally to the given path, filename needs to be specified at the end of the path, not the extension. Creates the file at given path if it doesn't exist yet, overwrites it otherwise.- Parameters:
path
- local path ending- Throws:
java.io.IOException
- If the file is not found.
-
-