|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTask.Support.CoreSupport.ZipObject<T>
public class ZipObject<T extends java.io.Serializable>
ZipObject is a utility class for compressing and decompressing any object. The idea is to compress object parameters before passing them to remote objects. The reason for doing this is improving network transmission speeds. With most customers using modems, compressing any data transmission even by 50% is a great help. Since most transmissions are textual, the compression should be even better on those.
This class uses Serialization, ObjectIn/OutputStreams, and ByteArrayIn/OutputStreams.
| Field Summary | |
|---|---|
protected byte[] |
buffer
Internal byteArray buffer for storing the compressed Serializable obj |
| Constructor Summary | |
|---|---|
ZipObject(T obj)
Constructor for a ZipObject given an uncompressed object. |
|
| Method Summary | |
|---|---|
static ZipObject |
fromBytes(byte[] bytes)
Given a byte[] which contains the output of toBytes(), allows the original uncompressed
object to be reconstituted... using getObject(). |
static ZipObject |
fromInputStream(java.io.InputStream is)
Given an InputStream which contains the output of toBytes(), allows the original
uncompressed object to be reconstituted... using getObject(). |
T |
getObject()
this method extracts the compress object (from this ZipObject) and returns it. |
int |
getSize()
|
java.lang.String |
getSizeString()
|
static void |
main(java.lang.String[] args)
SELF TEST METHOD |
byte[] |
toBytes()
simply returns the internal byte array used to store the ZipObject data in |
java.io.InputStream |
toInputStream()
returns an InputStream that can read from the buffer of the ZipObject |
java.lang.String |
toString()
returns a string representation of the ZipObject |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected byte[] buffer
| Constructor Detail |
|---|
public ZipObject(T obj)
throws ZipObjectException
obj - Uncompressed Serializable object which has to be compressed
ZipObjectException - this is thrown if the object couldnt be compressed for whatever
reason| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Object
public byte[] toBytes()
throws ZipObjectException
ZipObjectException
public java.io.InputStream toInputStream()
throws ZipObjectException
ZipObjectExceptionpublic int getSize()
public java.lang.String getSizeString()
public static ZipObject fromBytes(byte[] bytes)
throws java.lang.IllegalArgumentException
toBytes(), allows the original uncompressed
object to be reconstituted... using getObject().
java.lang.IllegalArgumentException
public static ZipObject fromInputStream(java.io.InputStream is)
throws java.io.IOException,
java.lang.IllegalArgumentException
toBytes(), allows the original
uncompressed object to be reconstituted... using getObject().
java.io.IOException
java.lang.IllegalArgumentException
public final T getObject()
throws ZipObjectException
ZipObjectException - this is thrown if the object could not be uncompressed for whatever
reasonpublic static void main(java.lang.String[] args)
args - command line args
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||