FlinkKeyUtils { static ByteBuffer fromEncodedKey(ByteString encodedKey) { return ByteBuffer.wrap(encodedKey.toByteArray()); }  static ByteBuffer encodeKey(K key, Coder<K> keyCoder); static K decodeKey(ByteBuffer byteBuffer, Coder<K> keyCoder);  }
@Test @SuppressWarnings("ByteBufferBackingArray") public void testFromEncodedKey() { ByteString input = ByteString.copyFrom("hello world".getBytes(Charsets.UTF_8)); ByteBuffer encodedKey = FlinkKeyUtils.fromEncodedKey(input); assertThat(encodedKey.array(), is(input.toByteArray())); }