@Override
public void write(final OutputStream out) throws IOException {
CountingOutputStream counting = new CountingOutputStream(out);
OutputStream output = counting;
try {
ObjectFunnel funnel;
funnel = ObjectFunnels.newFunnel(output, DataStreamSerializationFactoryV1.INSTANCE);
packer.write(funnel, want, have, false, deduplicator);
counting.flush();
funnel.close();
} catch (IOException e) {
e.printStackTrace();
throw e;
} catch (RuntimeException e) {
e.printStackTrace();