Top Inners Constructors Methods
io.undertow.util

public Class Transfer

extends Object
Class Inheritance
Imports
io.undertow.UndertowMessages, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, org.xnio.ChannelExceptionHandler, .ChannelListener, .ChannelListeners, org.xnio.channels.Channels, .StreamSinkChannel, .StreamSourceChannel, java.io.IOException, java.nio.ByteBuffer, java.nio.channels.Channel

Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static <I extends StreamSourceChannel, O extends StreamSinkChannel> void
done(I source, O sink, ChannelListener<? super I> sourceListener, ChannelListener<? super O> sinkListener)

public static <I extends StreamSourceChannel, O extends StreamSinkChannel> void
initiateTransfer(final I
the source channel
source
,
final O
the target channel
sink
,
final ChannelListener<? super I>
the source listener to set and call when the transfer is complete, or null to clear the listener at that time
sourceListener
,
final ChannelListener<? super O>
the target listener to set and call when the transfer is complete, or null to clear the listener at that time
sinkListener
,
final ChannelExceptionHandler<? super I>
the read exception handler to call if an error occurs during a read operation
readExceptionHandler
,
final ChannelExceptionHandler<? super O>
the write exception handler to call if an error occurs during a write operation
writeExceptionHandler
,
ByteBufferPool
the pool from which the transfer buffer should be allocated
pool
)

Initiate a low-copy transfer between two stream channels.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Transferback to summary
public Transfer()

Method Detail

doneback to summary
private static <I extends StreamSourceChannel, O extends StreamSinkChannel> void done(I source, O sink, ChannelListener<? super I> sourceListener, ChannelListener<? super O> sinkListener)
initiateTransferback to summary
public static <I extends StreamSourceChannel, O extends StreamSinkChannel> void initiateTransfer(final I source, final O sink, final ChannelListener<? super I> sourceListener, final ChannelListener<? super O> sinkListener, final ChannelExceptionHandler<? super I> readExceptionHandler, final ChannelExceptionHandler<? super O> writeExceptionHandler, ByteBufferPool pool)

Initiate a low-copy transfer between two stream channels. The pool should be a direct buffer pool for best performance.

Parameters
source:I

the source channel

sink:O

the target channel

sourceListener:ChannelListener<? super I>

the source listener to set and call when the transfer is complete, or null to clear the listener at that time

sinkListener:ChannelListener<? super O>

the target listener to set and call when the transfer is complete, or null to clear the listener at that time

readExceptionHandler:ChannelExceptionHandler<? super I>

the read exception handler to call if an error occurs during a read operation

writeExceptionHandler:ChannelExceptionHandler<? super O>

the write exception handler to call if an error occurs during a write operation

pool:ByteBufferPool

the pool from which the transfer buffer should be allocated

io.undertow.util back to summary

pack-priv final Class Transfer.TransferListener<I extends StreamSourceChannel, O extends StreamSinkChannel>

extends Object
implements ChannelListener<Channel>
Class Inheritance
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private boolean
private final ByteBufferPool
private PooledByteBuffer
private final ChannelExceptionHandler<? super I>
private final O
private final ChannelListener<? super O>
private final I
private boolean
private final ChannelListener<? super I>
private final ChannelExceptionHandler<? super O>

Constructor Summary

AccessConstructor and Description
pack-priv
TransferListener(ByteBufferPool pool, final PooledByteBuffer pooledBuffer, final I source, final O sink, final ChannelListener<? super I> sourceListener, final ChannelListener<? super O> sinkListener, final ChannelExceptionHandler<? super O> writeExceptionHandler, final ChannelExceptionHandler<? super I> readExceptionHandler, boolean sourceDone)

Method Summary

Modifier and TypeMethod and Description
public void
handleEvent(final Channel
the channel event
channel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

doneback to summary
private boolean done
poolback to summary
private final ByteBufferPool pool
pooledBufferback to summary
private PooledByteBuffer pooledBuffer
readExceptionHandlerback to summary
private final ChannelExceptionHandler<? super I> readExceptionHandler
sinkback to summary
private final O sink
sinkListenerback to summary
private final ChannelListener<? super O> sinkListener
sourceback to summary
private final I source
sourceDoneback to summary
private boolean sourceDone
sourceListenerback to summary
private final ChannelListener<? super I> sourceListener
writeExceptionHandlerback to summary
private final ChannelExceptionHandler<? super O> writeExceptionHandler

Constructor Detail

TransferListenerback to summary
pack-priv TransferListener(ByteBufferPool pool, final PooledByteBuffer pooledBuffer, final I source, final O sink, final ChannelListener<? super I> sourceListener, final ChannelListener<? super O> sinkListener, final ChannelExceptionHandler<? super O> writeExceptionHandler, final ChannelExceptionHandler<? super I> readExceptionHandler, boolean sourceDone)

Method Detail

handleEventback to summary
public void handleEvent(final Channel channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:Channel

the channel event

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object