LengthPrefixCoder extends StructuredCoder<T> { @Override protected long getEncodedElementByteSize(T value) throws Exception { if (valueCoder instanceof StructuredCoder) { long valueSize = ((StructuredCoder<T>) valueCoder).getEncodedElementByteSize(value); return VarInt.getLength(valueSize) + valueSize; } return super.getEncodedElementByteSize(value); } private  LengthPrefixCoder(Coder<T> valueCoder); static LengthPrefixCoder<T> of(Coder<T> valueCoder); @Override void encode(T value, OutputStream outStream); @Override T decode(InputStream inStream); @Override List<? extends Coder<?>> getCoderArguments(); Coder<T> getValueCoder(); @Override void verifyDeterministic(); @Override boolean consistentWithEquals(); @Override boolean isRegisterByteSizeObserverCheap(T value);  }
@Test public void testEncodedSize() throws Exception { assertEquals(5L, TEST_CODER.getEncodedElementByteSize(TEST_VALUES.get(0))); }