Class FileStorageResource

  • All Implemented Interfaces:
    org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource, org.springframework.core.io.WritableResource

    public class FileStorageResource
    extends org.springframework.core.io.AbstractResource
    Implements WritableResource for reading and writing objects in Azure StorageAccount file. An instance of this class represents a handle to a file.
    Author:
    Warren Zhu
    • Constructor Detail

      • FileStorageResource

        public FileStorageResource​(com.azure.storage.file.share.ShareServiceClient shareServiceClient,
                                   String location)
        Creates a new instance of FileStorageResource.
        Parameters:
        shareServiceClient - the ShareServiceClient
        location - the location
      • FileStorageResource

        public FileStorageResource​(com.azure.storage.file.share.ShareServiceClient shareServiceClient,
                                   String location,
                                   Boolean autoCreateFiles)
        Creates a new instance of FileStorageResource.
        Parameters:
        shareServiceClient - the ShareServiceClient
        location - the location
        autoCreateFiles - whether to automatically create files
      • FileStorageResource

        public FileStorageResource​(com.azure.storage.file.share.ShareServiceClient shareServiceClient,
                                   String location,
                                   Boolean autoCreateFiles,
                                   String contentType)
        Creates a new instance of FileStorageResource.
        Parameters:
        shareServiceClient - the ShareServiceClient
        location - the location
        autoCreateFiles - whether to automatically create files
        contentType - the content type
    • Method Detail

      • exists

        public boolean exists()
        Specified by:
        exists in interface org.springframework.core.io.Resource
        Overrides:
        exists in class org.springframework.core.io.AbstractResource
      • getURL

        public URL getURL()
                   throws IOException
        Specified by:
        getURL in interface org.springframework.core.io.Resource
        Overrides:
        getURL in class org.springframework.core.io.AbstractResource
        Throws:
        IOException
      • getFile

        public File getFile()
        Specified by:
        getFile in interface org.springframework.core.io.Resource
        Overrides:
        getFile in class org.springframework.core.io.AbstractResource
      • contentLength

        public long contentLength()
        Specified by:
        contentLength in interface org.springframework.core.io.Resource
        Overrides:
        contentLength in class org.springframework.core.io.AbstractResource
      • lastModified

        public long lastModified()
        Specified by:
        lastModified in interface org.springframework.core.io.Resource
        Overrides:
        lastModified in class org.springframework.core.io.AbstractResource
      • createRelative

        public org.springframework.core.io.Resource createRelative​(String relativePath)
        Specified by:
        createRelative in interface org.springframework.core.io.Resource
        Overrides:
        createRelative in class org.springframework.core.io.AbstractResource
      • getFilename

        public String getFilename()
        Specified by:
        getFilename in interface org.springframework.core.io.Resource
        Overrides:
        getFilename in class org.springframework.core.io.AbstractResource
      • getDescription

        public String getDescription()
      • getContentType

        public String getContentType​(String location)
        Gets the content type.
        Parameters:
        location - the location
        Returns:
        the content type