Methods Summary |
---|
public static byte[] | compress(byte[] data)
ByteArrayOutputStream bout = new ByteArrayOutputStream();
GZIPOutputStream gout = new GZIPOutputStream(bout);
gout.write(data);
gout.flush();
gout.close();
return bout.toByteArray();
|
public static byte[] | decompress(byte[] data)
ByteArrayInputStream bin = new ByteArrayInputStream(data);
GZIPInputStream gin = new GZIPInputStream(bin);
byte[] tmp = new byte[DEFAULT_BUFFER_SIZE];
int length = gin.read(tmp);
byte[] result = new byte[length];
System.arraycopy(tmp,0,result,0,length);
return result;
|
public static void | main(java.lang.String[] arg)
byte[] data = new byte[1024];
Arrays.fill(data,(byte)1);
byte[] compress = compress(data);
byte[] decompress = decompress(compress);
System.out.println("Debug test");
|
public void | messageReceived(org.apache.catalina.tribes.ChannelMessage msg)
try {
byte[] data = decompress(msg.getMessage().getBytes());
msg.getMessage().trim(msg.getMessage().getLength());
msg.getMessage().append(data,0,data.length);
getPrevious().messageReceived(msg);
} catch ( IOException x ) {
log.error("Unable to decompress byte contents",x);
}
|
public void | sendMessage(org.apache.catalina.tribes.Member[] destination, org.apache.catalina.tribes.ChannelMessage msg, org.apache.catalina.tribes.group.InterceptorPayload payload)
try {
byte[] data = compress(msg.getMessage().getBytes());
msg.getMessage().trim(msg.getMessage().getLength());
msg.getMessage().append(data,0,data.length);
getNext().sendMessage(destination, msg, payload);
} catch ( IOException x ) {
log.error("Unable to compress byte contents");
throw new ChannelException(x);
}
|