Class ResourceBasedRemoteFile

java.lang.Object
org.craftercms.commons.file.stores.impl.ResourceBasedRemoteFile
All Implemented Interfaces:
RemoteFile

public class ResourceBasedRemoteFile extends Object implements RemoteFile
Implementation of RemoteFile that basically is facade to a Spring Resource.
Author:
avasquez
  • Constructor Details

    • ResourceBasedRemoteFile

      public ResourceBasedRemoteFile(RemotePath path, org.springframework.core.io.Resource resource)
  • Method Details

    • getPath

      public RemotePath getPath()
      Description copied from interface: RemoteFile
      Returns information about the path of the file in the remote store.
      Specified by:
      getPath in interface RemoteFile
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: RemoteFile
      Returns an input stream to the content of the file.
      Specified by:
      getInputStream in interface RemoteFile
      Throws:
      IOException - if an error occurs while trying to access the file content
    • getContentLength

      public long getContentLength() throws IOException
      Description copied from interface: RemoteFile
      Returns the content length of the file.
      Specified by:
      getContentLength in interface RemoteFile
      Throws:
      IOException - if an error occurs while trying to access the file
    • toResource

      public org.springframework.core.io.Resource toResource() throws IOException
      Description copied from interface: RemoteFile
      Returns the remote file as a Spring Resource.
      Specified by:
      toResource in interface RemoteFile
      Throws:
      IOException - if the file can't be resolved successfully as a resource