Class AbstractStreamWriteFilter<T>

    • Field Detail

      • DEFAULT_STREAM_BUFFER_SIZE

        public static final int DEFAULT_STREAM_BUFFER_SIZE
        The default buffer size this filter uses for writing.
        See Also:
        Constant Field Values
      • CURRENT_STREAM

        protected static final AttributeKey CURRENT_STREAM
        The attribute name used when binding the streaming object to the session.
      • WRITE_REQUEST_QUEUE

        protected static final AttributeKey WRITE_REQUEST_QUEUE
      • CURRENT_WRITE_REQUEST

        protected static final AttributeKey CURRENT_WRITE_REQUEST
    • Constructor Detail

      • AbstractStreamWriteFilter

        public AbstractStreamWriteFilter()
    • Method Detail

      • onPreAdd

        public void onPreAdd​(IoFilterChain parent,
                             java.lang.String name,
                             IoFilter.NextFilter nextFilter)
                      throws java.lang.Exception
        Invoked before this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked before IoFilter.init() is invoked.
        Specified by:
        onPreAdd in interface IoFilter
        Overrides:
        onPreAdd in class IoFilterAdapter
        Parameters:
        parent - the parent who called this method
        name - the name assigned to this filter
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • getMessageClass

        protected abstract java.lang.Class<T> getMessageClass()
      • getWriteBufferSize

        public int getWriteBufferSize()
        Returns:
        the size of the write buffer in bytes. Data will be read from the stream in chunks of this size and then written to the next filter.
      • setWriteBufferSize

        public void setWriteBufferSize​(int writeBufferSize)
        Sets the size of the write buffer in bytes. Data will be read from the stream in chunks of this size and then written to the next filter.
        Parameters:
        writeBufferSize - The size of the write buffer
        Throws:
        java.lang.IllegalArgumentException - if the specified size is < 1.
      • getNextBuffer

        protected abstract IoBuffer getNextBuffer​(T message)
                                           throws java.io.IOException
        Throws:
        java.io.IOException