Top Fields Constructors Methods
io.undertow.conduits

public final Class FinishableStreamSinkConduit

extends AbstractStreamSinkConduit<StreamSinkConduit>
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, org.xnio.Buffers, org.xnio.conduits.AbstractStreamSinkConduit, .StreamSinkConduit

Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final ConduitListener<? super FinishableStreamSinkConduit>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
flush()

Overrides org.xnio.conduits.AbstractSinkConduit.flush.

Implements org.xnio.conduits.SinkConduit.flush.

Flush out any unwritten, buffered output.

public void
public void
truncateWrites()

Overrides org.xnio.conduits.AbstractSinkConduit.truncateWrites.

Implements org.xnio.conduits.SinkConduit.truncateWrites.

Terminate writes and discard any outstanding write data.

public int
writeFinal(ByteBuffer
The data to write
src
)

Overrides org.xnio.conduits.AbstractStreamSinkConduit.writeFinal.

Implements org.xnio.conduits.StreamSinkConduit.writeFinal.

Writes some data to the conduit, with the same semantics as write(java.nio.ByteBuffer).

public long
writeFinal(ByteBuffer[]
The buffers from which bytes are to be retrieved
srcs
,
int
The offset within the buffer array of the first buffer from which bytes are to be retrieved; must be non-negative and no larger than srcs.length
offset
,
int
The maximum number of buffers to be accessed; must be non-negative and no larger than srcs.length - offset
length
)

Overrides org.xnio.conduits.AbstractStreamSinkConduit.writeFinal.

Implements org.xnio.conduits.StreamSinkConduit.writeFinal.

Writes some data to the conduit, with the same semantics as write(java.nio.ByteBuffer[], int, int).

Inherited from org.xnio.conduits.AbstractStreamSinkConduit:
transferFromtransferFromwritewrite

Field Detail

finishListenerback to summary
private final ConduitListener<? super FinishableStreamSinkConduit> finishListener
shutdownStateback to summary
private int shutdownState

Constructor Detail

FinishableStreamSinkConduitback to summary
public FinishableStreamSinkConduit(final StreamSinkConduit delegate, final ConduitListener<? super FinishableStreamSinkConduit> finishListener)

Method Detail

flushback to summary
public boolean flush() throws IOException

Overrides org.xnio.conduits.AbstractSinkConduit.flush.

Implements org.xnio.conduits.SinkConduit.flush.

Doc from org.xnio.conduits.SinkConduit.flush.

Flush out any unwritten, buffered output.

Returns:boolean

true if everything is flushed, false otherwise

Exceptions
IOException:
if flush fails
terminateWritesback to summary
public void terminateWrites() throws IOException

Overrides org.xnio.conduits.AbstractSinkConduit.terminateWrites.

Implements org.xnio.conduits.SinkConduit.terminateWrites.

Doc from org.xnio.conduits.SinkConduit.terminateWrites.

Signal that no more write data is forthcoming. The conduit must be flush()ed before it is considered to be shut down.

truncateWritesback to summary
public void truncateWrites() throws IOException

Overrides org.xnio.conduits.AbstractSinkConduit.truncateWrites.

Implements org.xnio.conduits.SinkConduit.truncateWrites.

Doc from org.xnio.conduits.SinkConduit.truncateWrites.

Terminate writes and discard any outstanding write data. The conduit is terminated and flushed regardless of the outcome of this method.

Annotations
@Override
Exceptions
IOException:
if channel termination failed for some reason
writeFinalback to summary
public int writeFinal(ByteBuffer src) throws IOException

Overrides org.xnio.conduits.AbstractStreamSinkConduit.writeFinal.

Implements org.xnio.conduits.StreamSinkConduit.writeFinal.

Doc from org.xnio.conduits.StreamSinkConduit.writeFinal.

Writes some data to the conduit, with the same semantics as write(java.nio.ByteBuffer). If all the data is written out then the conduit will have its writes terminated. Semantically this method is equivalent to: int rem = src.remaining(); int written = conduit.write(src); if(written == rem) { conduit.terminateWrites() }

Parameters
src:ByteBuffer

The data to write

Returns:int

The amount of data that was actually written.

Annotations
@Override
writeFinalback to summary
public long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException

Overrides org.xnio.conduits.AbstractStreamSinkConduit.writeFinal.

Implements org.xnio.conduits.StreamSinkConduit.writeFinal.

Doc from org.xnio.conduits.StreamSinkConduit.writeFinal.

Writes some data to the conduit, with the same semantics as write(java.nio.ByteBuffer[], int, int). If all the data is written out then the conduit will have its writes terminated.

Parameters
srcs:ByteBuffer[]

The buffers from which bytes are to be retrieved

offset:int

The offset within the buffer array of the first buffer from which bytes are to be retrieved; must be non-negative and no larger than srcs.length

length:int

The maximum number of buffers to be accessed; must be non-negative and no larger than srcs.length - offset

Returns:long

The amount of data that was actually written

Annotations
@Override