public class BoxFilesManager extends BoxItemsManager
Constructor and Description |
---|
BoxFilesManager(IBoxConfig config,
IBoxResourceHub resourceHub,
IBoxJSONParser parser,
IBoxRequestAuth auth,
IBoxRESTClient restClient)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BoxFile |
copyFile(java.lang.String fileId,
BoxFileRequestObject requestObject)
Copy a file.
|
BoxFile |
createSharedLink(java.lang.String fileId,
BoxFileRequestObject requestObject)
Create a shared link for a file, given the id of the file/folder.
|
void |
deleteFile(java.lang.String fileId,
BoxFileRequestObject requestObject)
Delete a file.
|
void |
deleteTrashFile(java.lang.String id,
BoxFileRequestObject requestObject)
Permanently delete a trashed 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)
Get thumbnail of a file.
|
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)
Get files in a collection.
|
static java.util.List<BoxFileVersion> |
getFileVersions(BoxCollection collection)
Get file versions in a collection.
|
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.
|
BoxFile |
getTrashFile(java.lang.String fileId,
BoxDefaultRequestObject requestObject)
Get trashed file given a file id.
|
BoxFile |
restoreTrashFile(java.lang.String id,
BoxItemRestoreRequestObject requestObject)
Restore a trashed 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, deleteTrashItem, getItem, getTrashItem, restoreTrashItem, updateItemInfo
executeRequestWithNoResponseBody, getAuth, getConfig, getJSONParser, getResourceHub, getResponseAndParse, getResponseAndParseAndTryCast, tryCastBoxItem, tryCastObject
public BoxFilesManager(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
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic BoxFile getTrashFile(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, AuthFatalFailureException, BoxServerException
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic void deleteFile(java.lang.String fileId, BoxFileRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic void deleteTrashFile(java.lang.String id, BoxFileRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
id
- id of the filerequestObject
- request objectBoxRestException
AuthFatalFailureException
BoxServerException
public BoxFile restoreTrashFile(java.lang.String id, BoxItemRestoreRequestObject requestObject) throws BoxRestException, AuthFatalFailureException, BoxServerException
id
- id of the trashed file.requestObject
- BoxRestException
AuthFatalFailureException
BoxServerException
public BoxPreview getPreview(java.lang.String fileId, java.lang.String extension, BoxImageRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the fileextension
- requested of the preview image file extensionrequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic java.io.InputStream downloadThumbnail(java.lang.String fileId, java.lang.String extension, BoxImageRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the fileextension
- file extension of requested thumbnailrequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic BoxFile uploadFile(BoxFileUploadRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException, java.lang.InterruptedException
requestObject
- reqeust objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedjava.lang.InterruptedException
public BoxFile copyFile(java.lang.String fileId, BoxFileRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exceptionpublic 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
fileId
- id of the filedestination
- destination of the downloaded filelistener
- listener to monitor the download progressrequestObject
- extra request object going into api requestBoxRestException
- exceptionBoxServerException
- exceptionjava.lang.IllegalStateException
- exceptionjava.io.IOException
- exceptionjava.lang.InterruptedException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic java.io.InputStream downloadFile(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the file to be downloadedrequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic void downloadFile(java.lang.String fileId, java.io.OutputStream[] outputStreams, IFileTransferListener listener, BoxDefaultRequestObject requestObject) throws BoxRestException, java.io.IOException, BoxServerException, java.lang.InterruptedException, AuthFatalFailureException
fileId
- id of the fileoutputStreams
- OutputStream's the file will be downloaded intolistener
- listener to monitor the download progressrequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionjava.io.IOException
- exceptionjava.lang.InterruptedException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic BoxFile uploadNewVersion(java.lang.String fileId, BoxFileUploadRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException, java.lang.InterruptedException
fileId
- id of the fileBoxFileUploadRequestObject
- requestObjectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exceptionjava.lang.InterruptedException
public java.util.List<BoxFileVersion> getFileVersions(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic BoxFile updateFileInfo(java.lang.String fileId, BoxFileRequestObject requestObject) throws java.io.UnsupportedEncodingException, BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- request objectjava.io.UnsupportedEncodingException
- exceptionBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic BoxFile createSharedLink(java.lang.String fileId, BoxFileRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic BoxCollection getFileComments(java.lang.String fileId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
fileId
- id of the filerequestObject
- object that goes into request.BoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic static java.util.List<BoxFile> getFiles(BoxCollection collection)
collection
- collectionpublic static java.util.List<BoxFileVersion> getFileVersions(BoxCollection collection)
collection
- collection