public class BoxFilesManagerImpl extends BoxItemsManagerImpl implements IBoxFilesManager
Constructor and Description |
---|
BoxFilesManagerImpl(IBoxConfig config,
IBoxResourceHub resourceHub,
IBoxJSONParser parser,
IBoxRequestAuth auth,
IBoxRESTClient restClient)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BoxFile |
copyFile(java.lang.String fileId,
BoxItemCopyRequestObject requestObject)
Copy a file.
|
BoxFile |
createSharedLink(java.lang.String fileId,
BoxSharedLinkRequestObject requestObject)
Create a shared link for a file, given the id of the file/folder.
|
void |
deleteFile(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Delete a file.
|
java.io.InputStream |
downloadFile(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Execute the download and return the raw InputStream.
|
void |
downloadFile(java.lang.String fileId,
java.io.File destination,
IFileTransferListener listener,
BoxDefaultRequestObject requestObject)
Download a file.
|
void |
downloadFile(java.lang.String fileId,
java.io.OutputStream[] outputStreams,
IFileTransferListener listener,
BoxDefaultRequestObject requestObject)
Download a file.
|
java.io.InputStream |
downloadThumbnail(java.lang.String fileId,
java.lang.String extension,
BoxImageRequestObject requestObject)
Deprecated.
|
BoxFile |
getFile(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Get file given a file id.
|
BoxCollection |
getFileComments(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Get comments on a file.
|
static java.util.List<BoxFile> |
getFiles(BoxCollection collection)
Deprecated.
|
static java.util.List<BoxFileVersion> |
getFileVersions(BoxCollection collection)
Deprecated.
|
java.util.List<BoxFileVersion> |
getFileVersions(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Get file versions(Note: Versions are only tracked for Box users with premium accounts.).
|
BoxPreview |
getPreview(java.lang.String fileId,
java.lang.String extension,
BoxImageRequestObject requestObject)
Get preview of a file.
|
BoxThumbnail |
getThumbnail(java.lang.String fileId,
java.lang.String extension,
BoxImageRequestObject requestObject)
Get thumbnail of a file.
|
BoxFile |
updateFileInfo(java.lang.String fileId,
BoxFileRequestObject requestObject)
Update info for a file.
|
BoxFile |
uploadFile(BoxFileUploadRequestObject requestObject)
Upload file/files.
|
BoxFile |
uploadNewVersion(java.lang.String fileId,
BoxFileUploadRequestObject requestObject)
Upload a new version of a file.
|
copyItem, createSharedLink, getItem, updateItemInfo
executeRequestWithNoResponseBody, getAuth, getClassFromType, getConfig, getJSONParser, getResourceHub, getResponseAndParse, getResponseAndParseAndTryCast, getRestClient, tryCastBoxItem, tryCastObject
public BoxFilesManagerImpl(IBoxConfig config, IBoxResourceHub resourceHub, IBoxJSONParser parser, IBoxRequestAuth auth, IBoxRESTClient restClient)
config
- BoxConfigresourceHub
- resource hubparser
- json parserauth
- auth for api callsrestClient
- REST client to make api calls.public BoxFile getFile(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
getFile
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public void deleteFile(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
deleteFile
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxPreview getPreview(java.lang.String fileId, java.lang.String extension, BoxImageRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
getPreview
in interface IBoxFilesManager
fileId
- id of the fileextension
- requested of the preview image file extensionrequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxThumbnail getThumbnail(java.lang.String fileId, java.lang.String extension, BoxImageRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
getThumbnail
in interface IBoxFilesManager
fileId
- id of the fileextension
- file extension of requested thumbnailrequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.@Deprecated public java.io.InputStream downloadThumbnail(java.lang.String fileId, java.lang.String extension, BoxImageRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
downloadThumbnail
in interface IBoxFilesManager
BoxRestException
BoxServerException
AuthFatalFailureException
public BoxFile uploadFile(BoxFileUploadRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException, java.lang.InterruptedException
IBoxFilesManager
uploadFile
in interface IBoxFilesManager
requestObject
- reqeust objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.java.lang.InterruptedException
public BoxFile copyFile(java.lang.String fileId, BoxItemCopyRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
copyFile
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public void downloadFile(java.lang.String fileId, java.io.File destination, IFileTransferListener listener, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, java.lang.IllegalStateException, java.io.IOException, java.lang.InterruptedException, AuthFatalFailureException
IBoxFilesManager
downloadFile
in interface IBoxFilesManager
fileId
- id of the filedestination
- destination of the downloaded filelistener
- listener to monitor the download progressrequestObject
- extra request object going into api requestBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.java.lang.IllegalStateException
- IllegalStateExceptionjava.io.IOException
- IOExceptionjava.lang.InterruptedException
- InterruptedExceptionAuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public java.io.InputStream downloadFile(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
downloadFile
in interface IBoxFilesManager
fileId
- id of the file to be downloadedrequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public void downloadFile(java.lang.String fileId, java.io.OutputStream[] outputStreams, IFileTransferListener listener, BoxDefaultRequestObject requestObject) throws BoxRestException, java.io.IOException, BoxServerException, java.lang.InterruptedException, AuthFatalFailureException
IBoxFilesManager
downloadFile
in interface IBoxFilesManager
fileId
- id of the fileoutputStreams
- OutputStream's the file will be downloaded intolistener
- listener to monitor the download progressrequestObject
- request objectBoxRestException
- See BoxRestException
for more info.java.io.IOException
- exceptionBoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.java.lang.InterruptedException
- exceptionAuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxFile uploadNewVersion(java.lang.String fileId, BoxFileUploadRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException, java.lang.InterruptedException
IBoxFilesManager
uploadNewVersion
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- requestObjectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.java.lang.InterruptedException
public java.util.List<BoxFileVersion> getFileVersions(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
getFileVersions
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxFile updateFileInfo(java.lang.String fileId, BoxFileRequestObject requestObject) throws java.io.UnsupportedEncodingException, BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
updateFileInfo
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- request objectjava.io.UnsupportedEncodingException
- exceptionBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxFile createSharedLink(java.lang.String fileId, BoxSharedLinkRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
createSharedLink
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- request objectBoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.public BoxCollection getFileComments(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
IBoxFilesManager
getFileComments
in interface IBoxFilesManager
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- See BoxRestException
for more info.BoxServerException
- See com.box.restclientv2.exceptions.BoxServerException
for more info.AuthFatalFailureException
- See com.box.restclientv2.exceptions.AuthFatalFailureException
for more info.@Deprecated public static java.util.List<BoxFile> getFiles(BoxCollection collection)
collection
- collection@Deprecated public static java.util.List<BoxFileVersion> getFileVersions(BoxCollection collection)
collection
- collection