Ontimize 5.2072EN

com.ontimize.util.remote
Class BytesBlock

java.lang.Object
  extended bycom.ontimize.util.remote.BytesBlock
All Implemented Interfaces:
java.io.Serializable

public class BytesBlock
extends java.lang.Object
implements java.io.Serializable

Generic class that represents a Byte array implementing custom Serializable techniques. Moreover, some types of compression are allowed in these processes.

Author:
Imatia Innovation
See Also:
Serialized Form

Field Summary
static int BEST_COMPRESSION
           
static int BEST_SPEED
           
static int DEFAULT_COMPRESSION
           
static int HUFFMAN_ONLY
           
static int NO_COMPRESSION
           
 long serializationFinalTime
           
 long serializationStartTime
           
 
Constructor Summary
BytesBlock(byte[] byteArray)
          Builds a BytesBlock with parameter byteArray.
BytesBlock(byte[] byteArray, int compressionLevel)
          Builds a BytesBlock from an Byte Array.
 
Method Summary
protected  byte[] compressionBytes(byte[] bytesToCompress, int compressionLevel)
           
protected  byte[] decompressionBytes(byte[] bytesToDecompress)
           
 boolean equals(java.lang.Object object)
          If byte array is equals in both compared objects returns true.
 byte[] getBytes()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_COMPRESSION

public static final int NO_COMPRESSION
See Also:
Constant Field Values

BEST_COMPRESSION

public static final int BEST_COMPRESSION
See Also:
Constant Field Values

BEST_SPEED

public static final int BEST_SPEED
See Also:
Constant Field Values

DEFAULT_COMPRESSION

public static final int DEFAULT_COMPRESSION
See Also:
Constant Field Values

HUFFMAN_ONLY

public static final int HUFFMAN_ONLY
See Also:
Constant Field Values

serializationStartTime

public long serializationStartTime

serializationFinalTime

public long serializationFinalTime
Constructor Detail

BytesBlock

public BytesBlock(byte[] byteArray)
Builds a BytesBlock with parameter byteArray. Serialization will be executed with default method (with compression). Moreover, object will determine itself if byteArray compression is justified.

Parameters:
byteArray - the byte array

BytesBlock

public BytesBlock(byte[] byteArray,
                  int compressionLevel)
Builds a BytesBlock from an Byte Array. Serialization will be executed with default method and without compression (NO_COMPRESSION). If in parameter compressionLevel is passed NO_COMPRESSION, this constructor will be equivalent to BytesBlock(byte[]).

When an object is serialized to disk, NO_COMPRESSION is about twenty times better in performance than Compression. However, when serialization is executed over RMI, generally results are inverted.

Parameters:
byteArray - the byte array
compressionLevel - Indicates the level of compression is defined in this class according to Deflater
Method Detail

getBytes

public byte[] getBytes()

compressionBytes

protected byte[] compressionBytes(byte[] bytesToCompress,
                                  int compressionLevel)

decompressionBytes

protected byte[] decompressionBytes(byte[] bytesToDecompress)

equals

public boolean equals(java.lang.Object object)
If byte array is equals in both compared objects returns true. Otherwise, false.

Parameters:
object - Object to compare

Ontimize