File

Version 1.9 - Updated on 02/14/2017

Contents

Introduction

public interface File extends ResourceItem

Stores file information.

getMimeType

String getMimeType()

  • Returns: The content type of the file.

getChecksum

String getChecksum()

  • Returns: The checksum of the file.

getCreationDate

String getCreationDate()

  • Returns: The date, in UTC format, when the file has been created on the client system.

isFavorite

boolean isFavorite()

  • Returns: True if the file or folder is a user’s favorite.

isDeleted

boolean isDeleted()

  • Returns: True if the file or folder deleted.

getLocationStreet

String getLocationStreet()

  • Returns: The street address.

getLocationLocality

String getLocationLocality()

  • Returns: The city, town, village, or general locality.

getLocationCounty

String getLocationCounty()

  • Returns: The county.

getLocationCountry

String getLocationCountry()

  • Returns: The country.

getLocationRegion

String getLocationRegion()

  • Returns: The state, province, or general region.

getLocationPostalCode

String getLocationPostalCode()

  • Returns: The postcode or zip code.

getLocationCountryCode

String getLocationCountryCode()

  • Returns: The country code.

getModificationDate

String getModificationDate()

  • Returns: The date, in UTC format, when the file has been last modified on the client device.

getPriority

int getPriority()

  • Returns: A client-provided value, used to sort files or folders in order of importance, or as criteria to return only high-priority items

getSource

String getSource()

  • Returns: The origin of the file, such as MMS or web client.

getTags

String getTags()

  • Returns: Any tag metadata that a client includes when uploading a file.

getTimelineDate

String getTimelineDate()

  • Returns: Date in UTC format that specifies where the media file is to appear in a timeline view on a client application.

getItemuid

String getItemuid()

  • Returns: Item’s unique identifier.

delete

boolean delete(Context context, Boolean purge)

Deletes a folder or a file from user’s Persoanl Cloud Storage account at the path specified in the argument. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHORIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • purge — If set to true, deletes the file or folder. If not set, the default is false.
  • Returns: Returns true if delete was successful, false otherwise. Throws Cloud API Exception if the request cannot be processed.

move

File move(Context context, String target, Boolean safe, String conflictSolve)

Moves a file or a folder. If there is a missing folder in the target path, the folder is created. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • target — Cloud path where the folder or the file has to be moved to.
    • safe — If set to *true, ensures that name conflicts are resolved according to the value of the conflictsolve parameter. Defaults to false, in which case the operation overwrites an existing file or folder of the same name. Set to null for default.
    • conflictSolve — Defines how name conflicts are resolved if the safe parameter is set to true. If set to copy, a new file is written to the destination folder with a non-conflicting name. If not set, the operation is rolled back and returns 409 Conflict error message.
  • Returns: Returns File object populated with file information

copy

File copy(Context context, String target, Boolean safe, String conflictSolve, String override)

Creates a copy of a file or folder. If there is a missing folder in the target path, creates a missing folder. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • target — Cloud path where the folder or the file has to be copied to.
    • safe — If set to *true, ensures that name conflicts are resolved according to the value of the conflictsolve parameter. Defaults to false, in which case the operation overwrites an existing file or folder of the same name. Set to null for default.
    • conflictSolve — Defines how name conflicts are resolved if the safe parameter is set to true. If set to copy, a new file is written to the destination folder with a non-conflicting name. If not set, the operation is rolled back and returns 409 Conflict error message.
    • override — Specifies what happens when a folder of the same name already exists at the specified path:
      • overwrite - overwrites the existing folder.
      • modify - treats the new folder as a modification of the existing folder.
      If the override parameter is not set, the following algorithm is applied:
      • If the existing folder’s deleted attribute is set to true, the folder is overwritten.
      • If the existing folder’s deleted attribute is set to false or not set, the existing folder is modified.
  • Returns: Returns File object populated with file information.

rename

File rename(Context context, String target, Boolean safe, String conflictSolve)

Rename a fileor a folder stored under user’s cloud storage account. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • target — Full path of the target file or folder for copy, move, or rename operations. In case of files, the full or changed name should be included in the target.
    • safe — If set to *true, ensures that name conflicts are resolved according to the value of the conflictsolve parameter. Defaults to false, in which case the operation overwrites an existing file or folder of the same name. Set to null for default.
    • conflictSolve — Defines how name conflicts are resolved if the safe parameter is set to true. If set to copy, a new file is written to the destination folder with a non-conflicting name. If not set, the operation is rolled back and returns 409 Conflict error message.
  • Returns: Returns File object populated with file information.

download

boolean download(Context context, String downloadPath)

Downloads a file from user’s cloud storage account. File is downloaded at the downloadPath} location. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • downloadPath — Intended destination directory path.
  • Returns: true if download was successful, false otherwise. Throws Cloud API Exception if the request cannot be processed.

getThumbnailToStream

boolean getThumbnailToStream(Context context, OutputStream outputStream)

Downloads a thumbnail to the output stream. This method resizes the thumbnail to - 128X128. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • outputStream — Output stream where thumbnail bytes are intended to be written.
  • Returns: True if thumbnail download to the stream was successful, false otherwise. Throws Cloud API Exception if the request cannot be processed.

getThumbnailToStream

boolean getThumbnailToStream(Context context, OutputStream outputStream, int height, int width)

Downloads a resized thumbnail to the output stream. Thumbnail is resized to the height and width provided in the argument. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • outputStream — Output stream where thumbnail bytes are to be written.
    • height — Intended height of resized thumbnail.
    • width — Intended width of resized thumbnail.
  • Returns: True if thumbnail download to the stream was successful, false otherwise. Throws Cloud API Exception if the request cannot be processed.

getThumbnailToStream

boolean getThumbnailToStream(Context context, OutputStream outputStream, ThumbnailSize size)

Downloads a thumbnail to the output stream. This method resizes the thumbnail to the ThumbnailSize provided in the argument. This method makes an HTTP call and should not be called from the main thread. Throws Cloud API Exception with the error code USER_UNAUTHAURIZED if the user is not authorized to perform this operation.

  • Parameters:
    • context — Context object
    • outputStream — Output stream where thumbnail bytes are to be written.
    • size — Size of thumbnail to be downloaded as defined in ThumbnailSize.
      • Extra Small size - (24x24)
      • Small size - (64x64)
      • Medium size - (128x128)
  • Returns: True if thumbnail download to the stream was successful, false otherwise. Throws Cloud API Exception if the request cannot be processed.

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.