Class StringWriteChannelListener

  • All Implemented Interfaces:
    java.util.EventListener, org.xnio.ChannelListener<org.xnio.channels.StreamSinkChannel>

    public class StringWriteChannelListener
    extends java.lang.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, instead setup(org.xnio.channels.StreamSinkChannel) should be called, which will attempt a write, and only add the listener if required.
    Author:
    Stuart Douglas
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.xnio.ChannelListener

        org.xnio.ChannelListener.Setter<T extends java.nio.channels.Channel>, org.xnio.ChannelListener.SimpleSetter<T extends java.nio.channels.Channel>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void handleError​(org.xnio.channels.StreamSinkChannel channel, java.io.IOException e)  
      void handleEvent​(org.xnio.channels.StreamSinkChannel channel)  
      boolean hasRemaining()  
      void setup​(org.xnio.channels.StreamSinkChannel channel)  
      protected void writeDone​(org.xnio.channels.StreamSinkChannel channel)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringWriteChannelListener

        public StringWriteChannelListener​(java.lang.String string)
      • StringWriteChannelListener

        public StringWriteChannelListener​(java.lang.String string,
                                          java.nio.charset.Charset charset)
    • Method Detail

      • setup

        public void setup​(org.xnio.channels.StreamSinkChannel channel)
      • handleError

        protected void handleError​(org.xnio.channels.StreamSinkChannel channel,
                                   java.io.IOException e)
      • handleEvent

        public void handleEvent​(org.xnio.channels.StreamSinkChannel channel)
        Specified by:
        handleEvent in interface org.xnio.ChannelListener<org.xnio.channels.StreamSinkChannel>
      • hasRemaining

        public boolean hasRemaining()
      • writeDone

        protected void writeDone​(org.xnio.channels.StreamSinkChannel channel)