Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server.io
Class MultiMessageFilter

java.lang.Object
  extended by org.jboss.errai.bus.server.io.MultiMessageFilter
All Implemented Interfaces:
BufferFilter

public class MultiMessageFilter
extends Object
implements BufferFilter

This BufferFilter is used for re-writing the data in the buffer to permit properly formed multi-message payloads. This is because ErraiBus J.REP messages are delivered into the bus as single-message payloads. This filter prepends '[' to the data coming from the buffer, and inserts a ',' between each message in the stream. It then appends a ']' to the message to complete the payload.

For instance, consider the following buffer data:

{"foo":"bar"}{"bar":"foo"}

This filter will transform this to:

[{"foo":"bar"},{"bar":"foo"}]

Author:
Mike Brock

Constructor Summary
MultiMessageFilter()
           
 
Method Summary
 void after(ByteWriteAdapter outstream)
           
 void before(ByteWriteAdapter outstream)
           
 int each(int i, ByteWriteAdapter outstream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiMessageFilter

public MultiMessageFilter()
Method Detail

before

public void before(ByteWriteAdapter outstream)
            throws IOException
Specified by:
before in interface BufferFilter
Throws:
IOException

each

public int each(int i,
                ByteWriteAdapter outstream)
         throws IOException
Specified by:
each in interface BufferFilter
Throws:
IOException

after

public void after(ByteWriteAdapter outstream)
           throws IOException
Specified by:
after in interface BufferFilter
Throws:
IOException

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.