接口 WritableResource

    • 方法详细资料

      • isWritable

        default boolean isWritable()
        Indicate whether the contents of this resource can be written via 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()
      • getOutputStream

        java.io.OutputStream getOutputStream()
                                      throws java.io.IOException
        Return an OutputStream for 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.IOException
        Return a WritableByteChannel.

        It is expected that each call creates a fresh channel.

        The default implementation returns Channels.newChannel(OutputStream) with the result of getOutputStream().

        返回:
        the byte channel for the underlying resource (must not be null)
        抛出:
        java.io.FileNotFoundException - if the underlying resource doesn't exist
        java.io.IOException - if the content channel could not be opened
        从以下版本开始:
        5.0
        另请参阅:
        getOutputStream()