Spring Framework

org.springframework.core.io
Interface WritableResource

All Superinterfaces:
InputStreamSource, Resource
All Known Implementing Classes:
FileSystemResource

public interface WritableResource
extends Resource

Extended interface for a resource that supports writing to it. Provides an OutputStream accessor.

Since:
3.1
Author:
Juergen Hoeller
See Also:
OutputStream

Method Summary
 java.io.OutputStream getOutputStream()
          Return an OutputStream for the underlying resource, allowing to (over-)write its content.
 boolean isWritable()
          Return whether the contents of this resource can be modified, e.g.
 
Methods inherited from interface org.springframework.core.io.Resource
contentLength, createRelative, exists, getDescription, getFile, getFilename, getInputStream, getURI, getURL, isOpen, isReadable, lastModified
 

Method Detail

isWritable

boolean isWritable()
Return whether the contents of this resource can be modified, e.g. via getOutputStream() or Resource.getFile().

Will be true for typical resource descriptors; note that actual content writing may still fail when attempted. However, a value of false is a definitive indication that the resource content cannot be modified.

See Also:
getOutputStream(), Resource.isReadable()

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Return an OutputStream for the underlying resource, allowing to (over-)write its content.

Throws:
java.io.IOException - if the stream could not be opened
See Also:
Resource.getInputStream()

Spring Framework