org.objectweb.cjdbc.common.stream
Class CJDBCStream

java.lang.Object
  extended byorg.objectweb.cjdbc.common.stream.CJDBCStream

public class CJDBCStream
extends java.lang.Object

This is a useful stream class to compress and decompress object to a stream.

Author:
Nicolas Modrzyk

Field Summary
static int CLEAN_INTERVAL
          Clean the stream after CLEAN_INTERVAL call to writeUnshared
 
Constructor Summary
CJDBCStream()
           
 
Method Summary
static byte[] compressObject(java.lang.Object obj)
          Compress an object from its java form to byte array
static int countBytes(java.lang.Object obj)
          Statistic method to count the number of bytes of a class.
static java.lang.Object decompressObject(byte[] array)
          Decompress an object from its byte-compressed form to java object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEAN_INTERVAL

public static final int CLEAN_INTERVAL
Clean the stream after CLEAN_INTERVAL call to writeUnshared

See Also:
Constant Field Values
Constructor Detail

CJDBCStream

public CJDBCStream()
Method Detail

decompressObject

public static final java.lang.Object decompressObject(byte[] array)
                                               throws java.io.IOException,
                                                      java.lang.ClassNotFoundException
Decompress an object from its byte-compressed form to java object

Parameters:
array - of bytes
Returns:
the object if it can be retrieved
Throws:
java.io.IOException - if fails to read
java.lang.ClassNotFoundException - if class of object does not exist

compressObject

public static final byte[] compressObject(java.lang.Object obj)
                                   throws java.io.IOException
Compress an object from its java form to byte array

Parameters:
obj - to compress
Returns:
byte array
Throws:
java.io.IOException - if fails to read

countBytes

public static final int countBytes(java.lang.Object obj)
                            throws java.io.IOException
Statistic method to count the number of bytes of a class.

Parameters:
obj - to count bytes
Returns:
the number of bytes
Throws:
java.io.IOException - if fails to read


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.