Class FileStorageResource
- java.lang.Object
-
- org.springframework.core.io.AbstractResource
-
- com.azure.spring.autoconfigure.storage.resource.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.AbstractResourceImplementsWritableResourcefor reading and writing objects in Azure StorageAccount file. An instance of this class represents a handle to a file.- Author:
- Warren Zhu
-
-
Constructor Summary
Constructors Constructor Description FileStorageResource(com.azure.storage.file.share.ShareServiceClient shareServiceClient, String location)Creates a new instance ofFileStorageResource.FileStorageResource(com.azure.storage.file.share.ShareServiceClient shareServiceClient, String location, Boolean autoCreateFiles)Creates a new instance ofFileStorageResource.FileStorageResource(com.azure.storage.file.share.ShareServiceClient shareServiceClient, String location, Boolean autoCreateFiles, String contentType)Creates a new instance ofFileStorageResource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcontentLength()org.springframework.core.io.ResourcecreateRelative(String relativePath)booleanexists()StringgetContentType(String location)Gets the content type.StringgetDescription()FilegetFile()StringgetFilename()InputStreamgetInputStream()OutputStreamgetOutputStream()URLgetURL()longlastModified()-
Methods inherited from class org.springframework.core.io.AbstractResource
equals, getFileForLastModifiedCheck, getURI, hashCode, isFile, isOpen, isReadable, readableChannel, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
FileStorageResource
public FileStorageResource(com.azure.storage.file.share.ShareServiceClient shareServiceClient, String location)Creates a new instance ofFileStorageResource.- Parameters:
shareServiceClient- the ShareServiceClientlocation- the location
-
FileStorageResource
public FileStorageResource(com.azure.storage.file.share.ShareServiceClient shareServiceClient, String location, Boolean autoCreateFiles)Creates a new instance ofFileStorageResource.- Parameters:
shareServiceClient- the ShareServiceClientlocation- the locationautoCreateFiles- 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 ofFileStorageResource.- Parameters:
shareServiceClient- the ShareServiceClientlocation- the locationautoCreateFiles- whether to automatically create filescontentType- the content type
-
-
Method Detail
-
getOutputStream
public OutputStream getOutputStream() throws IOException
- Throws:
IOException
-
exists
public boolean exists()
- Specified by:
existsin interfaceorg.springframework.core.io.Resource- Overrides:
existsin classorg.springframework.core.io.AbstractResource
-
getURL
public URL getURL() throws IOException
- Specified by:
getURLin interfaceorg.springframework.core.io.Resource- Overrides:
getURLin classorg.springframework.core.io.AbstractResource- Throws:
IOException
-
getFile
public File getFile()
- Specified by:
getFilein interfaceorg.springframework.core.io.Resource- Overrides:
getFilein classorg.springframework.core.io.AbstractResource
-
contentLength
public long contentLength()
- Specified by:
contentLengthin interfaceorg.springframework.core.io.Resource- Overrides:
contentLengthin classorg.springframework.core.io.AbstractResource
-
lastModified
public long lastModified()
- Specified by:
lastModifiedin interfaceorg.springframework.core.io.Resource- Overrides:
lastModifiedin classorg.springframework.core.io.AbstractResource
-
createRelative
public org.springframework.core.io.Resource createRelative(String relativePath)
- Specified by:
createRelativein interfaceorg.springframework.core.io.Resource- Overrides:
createRelativein classorg.springframework.core.io.AbstractResource
-
getFilename
public String getFilename()
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource- Overrides:
getFilenamein classorg.springframework.core.io.AbstractResource
-
getDescription
public String getDescription()
-
getInputStream
public InputStream getInputStream() throws IOException
- Throws:
IOException
-
-