Interface TransferrableResource


public interface TransferrableResource
A resource that can be transferred to a file.

This can be useful in some situations where a resource is only temporary and must be moved somewhere to persist the data durably.

Since:
1.47
Version:
1.0
Author:
matt
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Transfer this resource to the given destination file.
  • Method Details

    • transferTo

      void transferTo(File dest) throws IOException, IllegalStateException
      Transfer this resource to the given destination file.

      This may either move the file in the filesystem, copy the file in the filesystem, or save memory-held contents to the destination file. If the destination file already exists, it will be deleted first.

      If the file has been moved in the filesystem, this operation cannot be invoked again. Therefore, call this method just once to be able to work with any storage mechanism.

      Parameters:
      dest - the destination file
      Throws:
      IOException - in case of reading or writing errors
      IllegalStateException - if the file has already been moved in the filesystem and is not available anymore for another transfer