Package com.amilesend.onedrive.resource
Class DriveFile
java.lang.Object
com.amilesend.onedrive.resource.DriveItemType
com.amilesend.onedrive.resource.DriveFile
A wrapper around a
DriveItem
that represents a file.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Downloads this file to the givenfolderPath
.void
Downloads this file to the givenfolderPath
and reports transfer progress to the specifiedTransferProgressCallback
.downloadAsync
(Path folderPath) Downloads this file asynchronously to the givenfolderPath
.downloadAsync
(Path folderPath, com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads this file asynchronously to the givenfolderPath
and reports transfer progress to the specifiedTransferProgressCallback
.Gets the audio file attributes.Gets the image file attributes.Gets the location attributes (e.g., photo taken from a cell phone).Gets the photo attributes (e.g., photo taken from a cell phone).Gets the vidoe file attributes.boolean
isAudio()
Describes if this is an audio file.boolean
isImage()
Describes if this is an image file.boolean
Determines if there is geolocation attributes for this file.boolean
isPhoto()
Describes if this has photo attributes.boolean
isVideo()
Describes if this is a video file.move
(@NonNull DriveFolder destinationFolder, String newName) Moves this file to the specifiedDriveFolder
along with the new file name.move
(DriveFolder destinationFolder) Moves this file to the specifiedDriveFolder
.Moves this file to the specifiednewParentId
(i.e., represents a new DriveFolder's ID) along with the new file name.preview
(PreviewRequest request) Gets the embeddable file preview URLs for inclusion in a web-based UI.toString()
update()
Updates the attributes for this file.Deprecated.Deprecated.useupload(Path, TransferProgressCallback)
insteadUploads and replaces this drive file's contents with the givenfile
.Uploads and replaces this drive file's contents with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.uploadAsync
(File file) Deprecated.useuploadAsync(Path)
insteaduploadAsync
(File file, com.amilesend.client.connection.file.TransferProgressCallback callback) Deprecated.useuploadAsync(Path, TransferProgressCallback)
insteaduploadAsync
(Path filePath) Uploads and replaces this drive file's contents asynchronously with the givenfile
.uploadAsync
(Path filePath, com.amilesend.client.connection.file.TransferProgressCallback callback) Uploads and replaces this drive file's contents asynchronously with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.Methods inherited from class com.amilesend.onedrive.resource.DriveItemType
addPermission, copy, copy, copy, copy, createSharingLink, delete, equals, getActivities, getCreatedBy, getCreatedDateTime, getETag, getFileSystemInfo, getId, getLastModifiedBy, getLastModifiedDateTime, getName, getPackage, getParentReference, getPermissions, getRemoteItem, getThumbnails, getVersions, hashCode, isDeleted, isFile, isFolder, isPackage, isRemote, setFileSystemInfo
-
Constructor Details
-
DriveFile
- Parameters:
delegate
- the drive item to wrap
-
-
Method Details
-
isAudio
public boolean isAudio()Describes if this is an audio file.- Returns:
true
if this file is an audio file; else,false
-
getAudioAttributes
Gets the audio file attributes. Can benull
.- Returns:
- the audio file attributes
- See Also:
-
isImage
public boolean isImage()Describes if this is an image file.- Returns:
true
if this file is an image file; else,false
-
getImageAttributes
Gets the image file attributes. Can benull
.- Returns:
- the image file attributes
- See Also:
-
isLocationAvailable
public boolean isLocationAvailable()Determines if there is geolocation attributes for this file.- Returns:
true
if this file has location attributes; else,false
-
getLocationAttributes
Gets the location attributes (e.g., photo taken from a cell phone). Can benull
.- Returns:
- the location file attributes
- See Also:
-
isPhoto
public boolean isPhoto()Describes if this has photo attributes. Can benull
.- Returns:
true
if this file contains photo attributes; else,false
-
getPhotoAttributes
Gets the photo attributes (e.g., photo taken from a cell phone). Can benull
.- Returns:
- the photo attributes
- See Also:
-
isVideo
public boolean isVideo()Describes if this is a video file.- Returns:
true
if this file is a video file; else,false
-
getVideoAttributes
Gets the vidoe file attributes. Can benull
.- Returns:
- the video file attributes
- See Also:
-
toString
-
download
Downloads this file to the givenfolderPath
.- Parameters:
folderPath
- the folder to download the file to
-
download
public void download(Path folderPath, com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads this file to the givenfolderPath
and reports transfer progress to the specifiedTransferProgressCallback
.- Parameters:
folderPath
- the folder to download the file tocallback
- the callback be notified of transfer progress- See Also:
-
downloadAsync
Downloads this file asynchronously to the givenfolderPath
. Consumers can block on transfer completion by invokingDriveFileDownloadExecution.get()
()}.- Parameters:
folderPath
- the folder to download the file to- Returns:
- the asynchronous execution that contains the number of bytes downloaded
- See Also:
-
downloadAsync
public DriveFileDownloadExecution downloadAsync(Path folderPath, com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads this file asynchronously to the givenfolderPath
and reports transfer progress to the specifiedTransferProgressCallback
. Consumers can block on transfer completion by invokingDriveFileDownloadExecution.get()
.- Parameters:
folderPath
- the folder to download the file tocallback
- the callback be notified of transfer progress- Returns:
- the asynchronous execution that contains the number of bytes downloaded
- See Also:
-
upload
Deprecated.useupload(Path)
insteadUploads and replaces this drive file's contents with the givenfile
.- Parameters:
file
- the updated file contents- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
upload
Uploads and replaces this drive file's contents with the givenfile
.- Parameters:
filePath
- the updated file contents- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
upload
@Deprecated public DriveFile upload(File file, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Deprecated.useupload(Path, TransferProgressCallback)
insteadUploads and replaces this drive file's contents with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.- Parameters:
file
- the updated file contentscallback
- the callback be notified of transfer progress- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
upload
public DriveFile upload(Path filePath, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads and replaces this drive file's contents with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.- Parameters:
filePath
- the updated file contentscallback
- the callback be notified of transfer progress- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
uploadAsync
Deprecated.useuploadAsync(Path)
insteadUploads and replaces this drive file's contents asynchronously with the givenfile
. Consumers can block on transfer completion by invokingDriveFileUploadExecution.get()
.- Parameters:
file
- the updated file contents- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
uploadAsync
Uploads and replaces this drive file's contents asynchronously with the givenfile
. Consumers can block on transfer completion by invokingDriveFileUploadExecution.get()
.- Parameters:
filePath
- the updated file contents- Returns:
- a new drive file that represents this updated file
- Throws:
IOException
- if unable to read the file.- See Also:
-
uploadAsync
@Deprecated public DriveFileUploadExecution uploadAsync(File file, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Deprecated.useuploadAsync(Path, TransferProgressCallback)
insteadUploads and replaces this drive file's contents asynchronously with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.- Parameters:
file
- the updated file contentscallback
- the callback be notified of transfer progress- Returns:
- the async execution used to obtain the drive file once it has completed
- Throws:
IOException
- if unable to read the file.- See Also:
-
uploadAsync
public DriveFileUploadExecution uploadAsync(Path filePath, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads and replaces this drive file's contents asynchronously with the givenfile
and reports transfer progress to the specifiedTransferProgressCallback
.- Parameters:
filePath
- the updated file contentscallback
- the callback be notified of transfer progress- Returns:
- the async execution used to obtain the drive file once it has completed
- Throws:
IOException
- if unable to read the file.- See Also:
-
update
Updates the attributes for this file.- Returns:
- the updated drive file
-
preview
Gets the embeddable file preview URLs for inclusion in a web-based UI. Note: For long-lived embeddable links, useDriveItemType.createSharingLink(CreateSharingLinkRequest)
instead.- Parameters:
request
- the preview item request- Returns:
- the preview URLs
-
move
Moves this file to the specifiedDriveFolder
.- Parameters:
destinationFolder
- the destination drive folder- Returns:
- the updated drive file that represents this moved file
-
move
Moves this file to the specifiedDriveFolder
along with the new file name.- Parameters:
destinationFolder
- the destination drive foldernewName
- the new name of the file- Returns:
- the updated drive file that represents this moved file
-
move
Moves this file to the specifiednewParentId
(i.e., represents a new DriveFolder's ID) along with the new file name.- Parameters:
destinationParentId
- the new parent destination IDnewName
- the new name of the file- Returns:
- the updated drive file that represents this moved file.
-
upload(Path)
instead