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 TypeMethodDescriptionvoidDownloads this file to the givenfolderPath.voidDownloads this file to the givenfolderPathand 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 givenfolderPathand 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.booleanisAudio()Describes if this is an audio file.booleanisImage()Describes if this is an image file.booleanDetermines if there is geolocation attributes for this file.booleanisPhoto()Describes if this has photo attributes.booleanisVideo()Describes if this is a video file.move(@NonNull DriveFolder destinationFolder, String newName) Moves this file to the specifiedDriveFolderalong 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 givenfileand 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 givenfileand reports transfer progress to the specifiedTransferProgressCallback.Methods inherited from class 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, setFileSystemInfoModifier and TypeMethodDescriptionaddPermission(AddPermissionRequest request) Adds a permission for the given request.copy(@NonNull DriveFolder destinationFolder, String newName) Copies this drive item type to the specifiedDriveFolderalong with the new file name.copy(DriveFolder destinationFolder) Copies this drive item type to the specifiedDriveFolder.Copies this drive item type to the specifiednewNamewithin the same folder.Copies this drive item type to the specifiednewParentId(i.e., represents a new DriveFolder's ID) along with the new file name.Creates a sharing link for the given request.voiddelete()Mark this drive item type for deletion.booleanGets the list of activities associated with this drive item.Gets the identity set that indicates who created this drive item.Gets the timestamp (formatted as a string) that indicates when this drive item was created.getETag()Gets the eTag associated with this item.Gets the local file system information associated with this drive item.getId()Gets the drive item identifier.Gets the identity set that indicates who made the last modification to this drive item.Gets the timestamp (formatted as a string) that indicates when this drive item was modified.getName()Gets the name of this drive item.Gets the package information associated with this drive item.Gets the parent reference of this drive item.Gets the list of permissions associated with this drive item.Gets the remote item information.Gets the list thumbnails associated with this drive item.Gets the list of versions for this drive item.inthashCode()booleanDescribes if this drive item has been marked for deletion.booleanisFile()Describes if this is a file.booleanisFolder()Describes if this is a folder.booleanDescribes if this is a package.booleanisRemote()Describes if this drive item represents a remote item from another drive.voidsetFileSystemInfo(@NonNull FileSystemInfo fileSystemInfo) Sets the local file system information associated with this drive item.
-
Constructor Details
-
DriveFile
-
-
Method Details
-
isAudio
public boolean isAudio()Describes if this is an audio file.- Returns:
trueif 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:
trueif 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:
trueif 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:
trueif 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:
trueif 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 givenfolderPathand 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 givenfolderPathand 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 givenfileand 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 givenfileand 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 givenfileand 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 givenfileand 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
-
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 specifiedDriveFolderalong 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