use of com.ms.silverking.cloud.dht.client.SecondaryTargetType in project SilverKing by Morgan-Stanley.
the class SecondaryTargetSerializer method deserialize.
public static Set<SecondaryTarget> deserialize(byte[] multiDef) {
try {
ImmutableSet.Builder<SecondaryTarget> specs;
int i;
specs = ImmutableSet.builder();
i = 0;
while (i < multiDef.length) {
SecondaryTargetType type;
int targetSize;
byte[] targetBytes;
String target;
type = SecondaryTargetType.values()[multiDef[i++]];
targetSize = NumConversion.bytesToShort(multiDef, i);
i += NumConversion.BYTES_PER_SHORT;
targetBytes = new byte[targetSize];
System.arraycopy(multiDef, i, targetBytes, 0, targetSize);
i += targetSize;
target = new String(targetBytes);
specs.add(new SecondaryTarget(type, target));
}
return specs.build();
} catch (Exception e) {
Log.logErrorWarning(e);
return ImmutableSet.of();
}
}
Aggregations