com.esotericsoftware.kryo.compress
Class DeltaCompressor

java.lang.Object
  extended by com.esotericsoftware.kryo.Serializer
      extended by com.esotericsoftware.kryo.Compressor
          extended by com.esotericsoftware.kryo.compress.DeltaCompressor

public class DeltaCompressor
extends Compressor

Caches bytes for the last object serialized (per remote entitiy) and only emits deltas on subsequent serializations. Also caches bytes for the last object received (per remote entitiy), in order to apply deltas received.

Author:
Nathan Sweet

Field Summary
 
Fields inherited from class com.esotericsoftware.kryo.Compressor
bufferSize
 
Constructor Summary
DeltaCompressor(Kryo kryo, Serializer serializer)
          Creates a DeltaCompressor with a buffer size of 2048 and a chunk size of 8.
DeltaCompressor(Kryo kryo, Serializer serializer, int bufferSize, int chunkSize)
           
 
Method Summary
 void compress(java.nio.ByteBuffer newData, java.lang.Object object, java.nio.ByteBuffer outputBuffer)
          The compressor should read the input buffer from the current position to the limit, compress the data, and put the result in the output buffer.
 void decompress(java.nio.ByteBuffer deltaData, java.lang.Class type, java.nio.ByteBuffer outputBuffer)
          The compressor should read the input buffer from the current position to the limit, decompress the data, and put the result in the output buffer.
 
Methods inherited from class com.esotericsoftware.kryo.Compressor
readObjectData, setCompress, setDecompress, writeObjectData
 
Methods inherited from class com.esotericsoftware.kryo.Serializer
isFinal, newInstance, readObject, setCanBeNull, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeltaCompressor

public DeltaCompressor(Kryo kryo,
                       Serializer serializer)
Creates a DeltaCompressor with a buffer size of 2048 and a chunk size of 8.


DeltaCompressor

public DeltaCompressor(Kryo kryo,
                       Serializer serializer,
                       int bufferSize,
                       int chunkSize)
See Also:
Delta.Delta(int, int)
Method Detail

compress

public void compress(java.nio.ByteBuffer newData,
                     java.lang.Object object,
                     java.nio.ByteBuffer outputBuffer)
Description copied from class: Compressor
The compressor should read the input buffer from the current position to the limit, compress the data, and put the result in the output buffer.

Specified by:
compress in class Compressor
outputBuffer - A non-direct buffer.

decompress

public void decompress(java.nio.ByteBuffer deltaData,
                       java.lang.Class type,
                       java.nio.ByteBuffer outputBuffer)
Description copied from class: Compressor
The compressor should read the input buffer from the current position to the limit, decompress the data, and put the result in the output buffer.

Specified by:
decompress in class Compressor
outputBuffer - A non-direct buffer.


Copyright © 2011. All Rights Reserved.