ColorCodec implements BlockCodec<Color> { @Override public Color decode(byte[] data, int bitLength) throws BlockCodecException { return new Color(0x0ff & data[0], 0x0ff & data[1], 0x0ff & data[2]); }  @Override Color zeroValue(); @Override Color decode(byte[] data, int bitLength); @Override byte[] encode(Color data, int bitLength); @Override void reset(); @Override String getValueType();  }
@Test public void testDecode() throws BlockCodecException { ColorCodec codec = new ColorCodec(); Color color = codec.decode(new byte[] { (byte) 0xff, 0x00, 0x00 }, 24); Assert.assertEquals(Color.red, color); }