public class OssStorageResource extends Object implements org.springframework.core.io.WritableResource
Resource for reading and writing objects in Aliyun Object Storage
Service (OSS). An instance of this class represents a handle to a bucket or an
OSSObject.OSS,
Bucket,
OSSObject| 构造器和说明 |
|---|
OssStorageResource(com.aliyun.oss.OSS oss,
String location,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
OssStorageResource(com.aliyun.oss.OSS oss,
String location,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
boolean autoCreateFiles) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
bucketExists()
Checks for the existence of the
Bucket associated with the resource. |
long |
contentLength() |
com.aliyun.oss.model.Bucket |
createBucket()
create a bucket.
|
org.springframework.core.io.Resource |
createRelative(String relativePath) |
boolean |
exists() |
com.aliyun.oss.model.Bucket |
getBucket()
Returns the
Bucket associated with the resource. |
String |
getDescription() |
File |
getFile() |
String |
getFilename() |
InputStream |
getInputStream() |
com.aliyun.oss.model.OSSObject |
getOSSObject()
Gets the underlying resource object in Aliyun Object Storage Service.
|
OutputStream |
getOutputStream()
acquire an OutputStream for write.
|
URI |
getURI() |
URL |
getURL()
Since the oss: protocol will normally not have a URL stream handler registered,
this method will always throw a
MalformedURLException. |
boolean |
isAutoCreateFiles() |
boolean |
isBucket()
Check if this resource references a bucket and not a blob.
|
boolean |
isWritable() |
long |
lastModified() |
public OssStorageResource(com.aliyun.oss.OSS oss,
String location,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
public OssStorageResource(com.aliyun.oss.OSS oss,
String location,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
boolean autoCreateFiles)
public boolean isAutoCreateFiles()
public boolean exists()
exists 在接口中 org.springframework.core.io.Resourcepublic URL getURL() throws IOException
MalformedURLException.getURL 在接口中 org.springframework.core.io.ResourceIOExceptionpublic URI getURI() throws IOException
getURI 在接口中 org.springframework.core.io.ResourceIOExceptionpublic File getFile() throws IOException
getFile 在接口中 org.springframework.core.io.ResourceIOExceptionpublic long contentLength()
throws IOException
contentLength 在接口中 org.springframework.core.io.ResourceIOExceptionpublic long lastModified()
throws IOException
lastModified 在接口中 org.springframework.core.io.ResourceIOExceptionpublic org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
createRelative 在接口中 org.springframework.core.io.ResourceIOExceptionpublic String getFilename()
getFilename 在接口中 org.springframework.core.io.Resourcepublic String getDescription()
getDescription 在接口中 org.springframework.core.io.Resourcepublic InputStream getInputStream() throws IOException
getInputStream 在接口中 org.springframework.core.io.InputStreamSourceIOExceptionpublic com.aliyun.oss.model.Bucket getBucket()
Bucket associated with the resource.public boolean bucketExists()
Bucket associated with the resource.public com.aliyun.oss.model.OSSObject getOSSObject()
com.aliyun.oss.OSSException - it is thrown upon error when accessing OSScom.aliyun.oss.ClientException - it is the one thrown by the client side when accessing OSSpublic boolean isBucket()
public com.aliyun.oss.model.Bucket createBucket()
public boolean isWritable()
isWritable 在接口中 org.springframework.core.io.WritableResourcepublic OutputStream getOutputStream() throws IOException
getOutputStream 在接口中 org.springframework.core.io.WritableResourceIOException - throw by oss operationCopyright © 2020 Pivotal Software, Inc.. All rights reserved.