Module org.xbib.rpm

Class WritableChannelWrapper

java.lang.Object
org.xbib.rpm.io.ChannelWrapper
org.xbib.rpm.io.WritableChannelWrapper
All Implemented Interfaces:
Closeable, AutoCloseable, Channel, WritableByteChannel

public class WritableChannelWrapper extends ChannelWrapper implements WritableByteChannel
Wrapper around a writable channel that allows for observing written data.
  • Field Details

  • Constructor Details

  • Method Details

    • write

      public int write(ByteBuffer buffer) throws IOException
      Writes data to the wrapped channel, while passing an exact copy to the registered consumers.
      Specified by:
      write in interface WritableByteChannel
      Parameters:
      buffer - the buffer to write to the wrapped channel
      Returns:
      the number of bytes written
      Throws:
      IOException - if an IO error occurs
    • close

      public void close() throws IOException
      Closes the underlying channel and completes any outstanding operations in the consumers.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Overrides:
      close in class ChannelWrapper
      Throws:
      IOException - if an IO error occurs
    • isOpen

      public boolean isOpen()
      Flag indicating whether the underlying channel is open.
      Specified by:
      isOpen in interface Channel
      Returns:
      true if it is open, false otherwise