Package io.undertow.util
Class StringWriteChannelListener
- java.lang.Object
-
- io.undertow.util.StringWriteChannelListener
-
- All Implemented Interfaces:
EventListener,org.xnio.ChannelListener<org.xnio.channels.StreamSinkChannel>
public class StringWriteChannelListener extends Object implements org.xnio.ChannelListener<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, insteadsetup(org.xnio.channels.StreamSinkChannel)should be called, which will attempt a write, and only add the listener if required.- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description StringWriteChannelListener(String string)StringWriteChannelListener(String string, Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidhandleError(org.xnio.channels.StreamSinkChannel channel, IOException e)voidhandleEvent(org.xnio.channels.StreamSinkChannel channel)booleanhasRemaining()voidsetup(org.xnio.channels.StreamSinkChannel channel)protected voidwriteDone(org.xnio.channels.StreamSinkChannel channel)
-
-
-
Method Detail
-
setup
public void setup(org.xnio.channels.StreamSinkChannel channel)
-
handleError
protected void handleError(org.xnio.channels.StreamSinkChannel channel, IOException e)
-
handleEvent
public void handleEvent(org.xnio.channels.StreamSinkChannel channel)
- Specified by:
handleEventin interfaceorg.xnio.ChannelListener<org.xnio.channels.StreamSinkChannel>
-
hasRemaining
public boolean hasRemaining()
-
writeDone
protected void writeDone(org.xnio.channels.StreamSinkChannel channel)
-
-