org.jboss.remoting.marshal.compress
Class CompressingMarshaller

java.lang.Object
  extended byorg.jboss.remoting.marshal.serializable.SerializableMarshaller
      extended byorg.jboss.remoting.marshal.compress.CompressingMarshaller
All Implemented Interfaces:
Marshaller, java.io.Serializable, SerialMarshaller

public class CompressingMarshaller
extends SerializableMarshaller

CompressingMarshaller and CompressingUnMarshaller are a general purpose compressing marshaller / decompressing unmarshaller pair based on Java's GZIP facilities.

CompressingMarshaller is subclassed from SerializableMarshaller, and by default it uses super.write() to marshall an object, which is then compressed. Optionally, it can wrap any other marshaller and use that instead of SerializableMarshaller to marshall an object before it is compressed. For example,

new CompressingMarshaller(new HTTPMarshaller())

will create a marshaller that compresses the output of an HTTPMarshaller.

Version:
$Revision: 1.5 $

Copyright (c) 2005

Author:
Ron Sigal
See Also:
Serialized Form

Field Summary
static java.lang.String DATATYPE
           
 
Constructor Summary
CompressingMarshaller()
          Create a new CompressingMarshaller.
CompressingMarshaller(Marshaller marshaller)
          Create a new CompressingMarshaller.
 
Method Summary
 Marshaller cloneMarshaller()
          Returns a CompressingMarshaller.
 void write(java.lang.Object dataObject, java.io.OutputStream output)
          Writes compressed, marshalled form of dataObject to output.
 
Methods inherited from class org.jboss.remoting.marshal.serializable.SerializableMarshaller
getSerializationType, setSerializationType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATATYPE

public static final java.lang.String DATATYPE
See Also:
Constant Field Values
Constructor Detail

CompressingMarshaller

public CompressingMarshaller()
Create a new CompressingMarshaller.


CompressingMarshaller

public CompressingMarshaller(Marshaller marshaller)
Create a new CompressingMarshaller.

Parameters:
marshaller - A Marshaller which is used to turn objects into byte streams.
Method Detail

write

public void write(java.lang.Object dataObject,
                  java.io.OutputStream output)
           throws java.io.IOException
Writes compressed, marshalled form of dataObject to output.

Specified by:
write in interface Marshaller
Overrides:
write in class SerializableMarshaller
Parameters:
dataObject - arbitrary object to be marshalled
output - OutputStream to which output is to be marshalled
Throws:
java.io.IOException

cloneMarshaller

public Marshaller cloneMarshaller()
                           throws java.lang.CloneNotSupportedException
Returns a CompressingMarshaller.

Specified by:
cloneMarshaller in interface Marshaller
Overrides:
cloneMarshaller in class SerializableMarshaller
Returns:
a CompressingMarshaller.
Throws:
java.lang.CloneNotSupportedException - In practice no exceptions are thrown


Copyright ? 1998-2005 JBoss Inc . All Rights Reserved.