Top Description Fields Constructors Methods
io.undertow.util

public Class StringWriteChannelListener

extends Object
implements ChannelListener<StreamSinkChannel>
Class Inheritance
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.charset.Charset, io.undertow.UndertowLogger, org.xnio.ChannelListener, .ChannelListeners, .IoUtils, org.xnio.channels.StreamSinkChannel

A simple write listener that can be used to write out the contents of a String. When the string is written out it closes the channel. This should not be added directly to the channel, instead setup(org.xnio.channels.StreamSinkChannel) should be called, which will attempt a write, and only add the listener if required.
Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private final ByteBuffer

Constructor Summary

AccessConstructor and Description
public
public
StringWriteChannelListener(final String string, Charset charset)

Method Summary

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

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

public boolean
public void
setup(final StreamSinkChannel channel)

protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final ByteBuffer buffer

Constructor Detail

StringWriteChannelListenerback to summary
public StringWriteChannelListener(final String string)
StringWriteChannelListenerback to summary
public StringWriteChannelListener(final String string, Charset charset)

Method Detail

handleErrorback to summary
protected void handleError(StreamSinkChannel channel, IOException e)
handleEventback to summary
public void handleEvent(final StreamSinkChannel channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:StreamSinkChannel

the channel event

Annotations
@Override
hasRemainingback to summary
public boolean hasRemaining()
setupback to summary
public void setup(final StreamSinkChannel channel)
writeDoneback to summary
protected void writeDone(final StreamSinkChannel channel)