Package org.filestack

Class FileLink

java.lang.Object
org.filestack.FileLink
All Implemented Interfaces:
Serializable

public class FileLink extends Object implements Serializable
References and performs operations on an individual file.
See Also:
  • Field Details

    • config

      protected final Config config
    • handle

      protected final String handle
  • Constructor Details

    • FileLink

      @Deprecated public FileLink(Config config, String handle)
      Deprecated.
      FileLink objects should not be created by hand - use Client.fileLink(String) to acquire them. This constructor is scheduled to be removed in version 1.0.0.
      Basic constructor for a FileLink.
  • Method Details

    • getContent

      public okhttp3.ResponseBody getContent() throws IOException
      Returns the content of a file.
      Returns:
      byte[] of file content
      Throws:
      HttpException - on error response from backend
      IOException - on network failure
    • download

      public File download(String directory) throws IOException
      Saves the file using the name it was uploaded with.
      Throws:
      IOException
      See Also:
    • download

      public File download(String directory, @Nullable String filename) throws IOException
      Saves the file overriding the name it was uploaded with.
      Parameters:
      directory - location to save the file in
      filename - local name for the file
      Throws:
      HttpException - on error response from backend
      IOException - on error creating file or network failure
    • overwrite

      public void overwrite(String pathname) throws IOException
      Replace the content of an existing file handle. Requires security to be set. Does not update the filename or MIME type.
      Parameters:
      pathname - path to the file, can be local or absolute
      Throws:
      HttpException - on error response from backend
      IOException - on error reading file or network failure
    • delete

      public void delete() throws IOException
      Deletes a file handle. Requires security to be set.
      Throws:
      HttpException - on error response from backend
      IOException - on network failure
    • imageTransform

      public ImageTransform imageTransform()
      Creates an ImageTransform object for this file. A transformation call isn't made directly by this method.
      Returns:
      ImageTransform instance configured for this file
    • imageTags

      public Map<String,Integer> imageTags() throws IOException
      Returns tags from the Google Vision API for image FileLinks.
      Throws:
      HttpException - on error response from backend
      IOException - on network failure
      See Also:
    • imageSfw

      public boolean imageSfw() throws IOException
      Determines if an image FileLink is "safe for work" using the Google Vision API.
      Throws:
      HttpException - on error response from backend
      IOException - on network failure
      See Also:
    • avTransform

      public AvTransform avTransform(AvTransformOptions avOptions)
      Creates an AvTransform object for this file using default storage options.
      See Also:
    • avTransform

      public AvTransform avTransform(@Nullable StorageOptions storeOptions, AvTransformOptions avOptions)
      Creates an AvTransform object for this file using custom storage options. A transformation call isn't made directly by this method. For both audio and video transformations.
      Parameters:
      storeOptions - options for how to save the file(s) in your storage backend
      avOptions - options for how ot convert the file
      Returns:
      ImageTransform instance configured for this file
    • getContentAsync

      public io.reactivex.Single<okhttp3.ResponseBody> getContentAsync()
      Asynchronously returns the content of a file.
      See Also:
    • downloadAsync

      public io.reactivex.Single<File> downloadAsync(String directory)
      Asynchronously saves the file using the name it was uploaded with.
      See Also:
    • downloadAsync

      public io.reactivex.Single<File> downloadAsync(String directory, @Nullable String filename)
      Asynchronously saves the file overriding the name it was uploaded with.
      See Also:
    • overwriteAsync

      public io.reactivex.Completable overwriteAsync(String pathname)
      Asynchronously replace the content of an existing file handle. Requires security to be set. Does not update the filename or MIME type.
      See Also:
    • deleteAsync

      public io.reactivex.Completable deleteAsync()
      Asynchronously deletes a file handle. Requires security to be set.
      See Also:
    • imageTagsAsync

      public io.reactivex.Single<Map<String,Integer>> imageTagsAsync()
      Asynchronously returns tags from Google Vision API for image FileLinks.
      See Also:
    • imageSfwAsync

      public io.reactivex.Single<Boolean> imageSfwAsync()
      Asynchronously determines if an image FileLink is "safe for work" using the Google Vision API.
      See Also:
    • getConfig

      @Deprecated public Config getConfig()
      Deprecated.
    • getHandle

      public String getHandle()