public interface WritableResource extends Resource
OutputStream accessor
.OutputStream
Modifier and Type | Method and Description |
---|---|
OutputStream |
getOutputStream()
Return an
OutputStream for the underlying resource,
allowing to (over-)write its content. |
default boolean |
isWritable()
Indicate whether the contents of this resource can be written
via
getOutputStream() . |
default WritableByteChannel |
writableChannel()
Return a
WritableByteChannel . |
contentLength, createRelative, exists, getDescription, getFile, getFilename, getURI, getURL, isFile, isOpen, isReadable, lastModified, readableChannel
getInputStream
default boolean isWritable()
getOutputStream()
.
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.
getOutputStream()
,
Resource.isReadable()
OutputStream getOutputStream() throws IOException
OutputStream
for the underlying resource,
allowing to (over-)write its content.IOException
- if the stream could not be openedInputStreamSource.getInputStream()
default WritableByteChannel writableChannel() throws IOException
WritableByteChannel
.
It is expected that each call creates a fresh channel.
The default implementation returns Channels.newChannel(OutputStream)
with the result of getOutputStream()
.
null
)FileNotFoundException
- if the underlying resource doesn't existIOException
- if the content channel could not be openedgetOutputStream()