TextIndexBunchedSerializer implements BunchedSerializer<Tuple, List<Integer>> { @Nonnull @Override public byte[] serializeEntry(@Nonnull Tuple key, @Nonnull List<Integer> value) { try { byte[] serializedKey = key.pack(); int listSize = getListSize(value); int size = getVarIntSize(serializedKey.length) + serializedKey.length + getVarIntSize(listSize) + listSize; ByteBuffer buffer = ByteBuffer.allocate(size); serializeVarInt(buffer, serializedKey.length); buffer.put(serializedKey); serializeList(buffer, value, listSize); return buffer.array(); } catch (RuntimeException e) { throw new BunchedSerializationException("unable to serialize entry", e) .setValue(new AbstractMap.SimpleImmutableEntry<>(key, value)); } } private  TextIndexBunchedSerializer(); static TextIndexBunchedSerializer instance(); @Nonnull @Override byte[] serializeKey(@Nonnull Tuple key); @Nonnull @Override byte[] serializeEntry(@Nonnull Tuple key, @Nonnull List<Integer> value); @Nonnull @Override byte[] serializeEntries(@Nonnull List<Map.Entry<Tuple, List<Integer>>> entries); @Nonnull @Override Tuple deserializeKey(@Nonnull byte[] data, int offset, int length); @Nonnull @Override List<Map.Entry<Tuple, List<Integer>>> deserializeEntries(@Nonnull Tuple key, @Nonnull byte[] data); @Nonnull @Override List<Tuple> deserializeKeys(@Nonnull Tuple key, @Nonnull byte[] data); @Override boolean canAppend();  }
@Test public void serializeEntry() { Tuple key = Tuple.from(1066L); List<Integer> value = Arrays.asList(0, 1, 127 + 1, 128 + 1 + 127); byte[] serialized = serializer.serializeEntry(key, value); assertArrayEquals(ByteArrayUtil.join( new byte[]{0x03}, key.pack(), new byte[]{0x05}, new byte[]{0x00, 0x01, 0x7f, (byte)0x81, 0x00} ), serialized); }