Class AbstractFixedLengthStreamSinkConduit

java.lang.Object
org.xnio.conduits.AbstractConduit<D>
org.xnio.conduits.AbstractSinkConduit<D>
org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
io.undertow.conduits.AbstractFixedLengthStreamSinkConduit
All Implemented Interfaces:
org.xnio.conduits.Conduit, org.xnio.conduits.SinkConduit, org.xnio.conduits.StreamSinkConduit
Direct Known Subclasses:
ServerFixedLengthStreamSinkConduit

public abstract class AbstractFixedLengthStreamSinkConduit extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
A channel which writes a fixed amount of data. A listener is called once the data has been written.
Author:
David M. Lloyd
  • Constructor Details

    • AbstractFixedLengthStreamSinkConduit

      public AbstractFixedLengthStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next, long contentLength, boolean configurable, boolean propagateClose)
      Construct a new instance.
      Parameters:
      next - the next channel
      contentLength - the content length
      configurable - true if this instance should pass configuration to the next
      propagateClose - true if this instance should pass close to the next
  • Method Details

    • reset

      protected void reset(long contentLength, boolean propagateClose)
    • write

      public int write(ByteBuffer src) throws IOException
      Specified by:
      write in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • write

      public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
      Specified by:
      write in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • writeFinal

      public long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException
      Specified by:
      writeFinal in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • writeFinal

      public int writeFinal(ByteBuffer src) throws IOException
      Specified by:
      writeFinal in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • transferFrom

      public long transferFrom(FileChannel src, long position, long count) throws IOException
      Specified by:
      transferFrom in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • transferFrom

      public long transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException
      Specified by:
      transferFrom in interface org.xnio.conduits.StreamSinkConduit
      Overrides:
      transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • flush

      public boolean flush() throws IOException
      Specified by:
      flush in interface org.xnio.conduits.SinkConduit
      Overrides:
      flush in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • isWriteResumed

      public boolean isWriteResumed()
      Specified by:
      isWriteResumed in interface org.xnio.conduits.SinkConduit
      Overrides:
      isWriteResumed in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
    • wakeupWrites

      public void wakeupWrites()
      Specified by:
      wakeupWrites in interface org.xnio.conduits.SinkConduit
      Overrides:
      wakeupWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
    • terminateWrites

      public void terminateWrites() throws IOException
      Specified by:
      terminateWrites in interface org.xnio.conduits.SinkConduit
      Overrides:
      terminateWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • truncateWrites

      public void truncateWrites() throws IOException
      Specified by:
      truncateWrites in interface org.xnio.conduits.SinkConduit
      Overrides:
      truncateWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • awaitWritable

      public void awaitWritable() throws IOException
      Specified by:
      awaitWritable in interface org.xnio.conduits.SinkConduit
      Overrides:
      awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • awaitWritable

      public void awaitWritable(long time, TimeUnit timeUnit) throws IOException
      Specified by:
      awaitWritable in interface org.xnio.conduits.SinkConduit
      Overrides:
      awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
      Throws:
      IOException
    • getRemaining

      public long getRemaining()
      Get the number of remaining bytes in this fixed length channel.
      Returns:
      the number of remaining bytes
    • channelFinished

      protected void channelFinished()