Search in sources :

Example 1 with ByteList

use of it.unimi.dsi.fastutil.bytes.ByteList in project SilverKing by Morgan-Stanley.

the class SecondaryTargetSerializer method serialize.

public static byte[] serialize(Set<SecondaryTarget> specs) {
    ByteList list;
    list = new ByteArrayList(initialBufferSize);
    for (SecondaryTarget spec : specs) {
        byte[] targetBytes;
        list.add((byte) spec.getType().ordinal());
        targetBytes = spec.getTarget().getBytes();
        list.addElements(list.size(), NumConversion.shortToBytes((short) targetBytes.length));
        list.addElements(list.size(), targetBytes);
    }
    return list.toByteArray();
}
Also used : SecondaryTarget(com.ms.silverking.cloud.dht.SecondaryTarget) ByteList(it.unimi.dsi.fastutil.bytes.ByteList) ByteArrayList(it.unimi.dsi.fastutil.bytes.ByteArrayList)

Aggregations

SecondaryTarget (com.ms.silverking.cloud.dht.SecondaryTarget)1 ByteArrayList (it.unimi.dsi.fastutil.bytes.ByteArrayList)1 ByteList (it.unimi.dsi.fastutil.bytes.ByteList)1