接口 WritableResource
-
- 所有超级接口:
InputStreamSource,Resource
- 所有已知实现类:
FileSystemResource,FileUrlResource,PathResource
public interface WritableResource extends Resource
Copy from https://github.com/spring-projects/spring-framework.git, with less modifications Extended interface for a resource that supports writing to it. Provides anOutputStream accessor.- 从以下版本开始:
- 3.1
- 作者:
- Juergen Hoeller
- 另请参阅:
OutputStream
-
-
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 java.io.OutputStreamgetOutputStream()Return anOutputStreamfor the underlying resource, allowing to (over-)write its content.default booleanisWritable()Indicate whether the contents of this resource can be written viagetOutputStream().default java.nio.channels.WritableByteChannelwritableChannel()Return aWritableByteChannel.-
从接口继承的方法 com.alibaba.nacos.common.packagescan.resource.InputStreamSource
getInputStream
-
从接口继承的方法 com.alibaba.nacos.common.packagescan.resource.Resource
contentLength, createRelative, exists, getDescription, getFile, getFilename, getUri, getUrl, isFile, isOpen, isReadable, lastModified, readableChannel
-
-
-
-
方法详细资料
-
isWritable
default boolean isWritable()
Indicate whether the contents of this resource can be written viagetOutputStream().Will be
truefor typical resource descriptors; note that actual content writing may still fail when attempted. However, a value offalseis a definitive indication that the resource content cannot be modified.
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOExceptionReturn anOutputStreamfor the underlying resource, allowing to (over-)write its content.- 抛出:
java.io.IOException- if the stream could not be opened- 另请参阅:
InputStreamSource.getInputStream()
-
writableChannel
default java.nio.channels.WritableByteChannel writableChannel() throws java.io.IOExceptionReturn aWritableByteChannel.It is expected that each call creates a fresh channel.
The default implementation returns
Channels.newChannel(OutputStream)with the result ofgetOutputStream().- 返回:
- the byte channel for the underlying resource (must not be
null) - 抛出:
java.io.FileNotFoundException- if the underlying resource doesn't existjava.io.IOException- if the content channel could not be opened- 从以下版本开始:
- 5.0
- 另请参阅:
getOutputStream()
-
-