use of com.ms.silverking.cloud.dht.serverside.SSStorageParameters in project SilverKing by Morgan-Stanley.
the class StorageParameterSerializer method main.
public static void main(String[] args) {
StorageParameters p1;
SSStorageParameters p2;
byte[] checksum;
byte[] valueCreator;
byte[] s;
checksum = new byte[ChecksumType.MD5.length()];
valueCreator = new byte[ValueCreator.BYTES];
p1 = new StorageParameters(1, 2, 3, CCSSUtil.createCCSS(Compression.NONE, ChecksumType.MD5, 0), checksum, valueCreator, System.currentTimeMillis());
System.out.println(p1);
s = serialize(p1);
p2 = deserialize(s);
System.out.println(p2);
}
use of com.ms.silverking.cloud.dht.serverside.SSStorageParameters in project SilverKing by Morgan-Stanley.
the class StorageParameterSerializer method deserialize.
public static SSStorageParameters deserialize(byte[] a) {
ByteBuffer b;
long version;
int uncompressedSize;
int compressedSize;
short ccss;
byte[] checksum;
byte[] valueCreator;
long creationTime;
b = ByteBuffer.wrap(a);
version = b.getLong();
uncompressedSize = b.getInt();
compressedSize = b.getInt();
creationTime = b.getLong();
ccss = b.getShort();
valueCreator = BufferUtil.arrayCopy(b, ValueCreator.BYTES);
checksum = BufferUtil.arrayCopy(b, CCSSUtil.getChecksumType(ccss).length());
return new StorageParameters(version, uncompressedSize, compressedSize, ccss, checksum, valueCreator, creationTime);
}
Aggregations