@Test public void testByteBufferSOrdering() { AttributeValue av1 = new AttributeValue().withBS(Collections.unmodifiableList( Arrays.asList(ByteBuffer.wrap(new byte[]{0, 1, 2, 3, 4, 5}), ByteBuffer.wrap(new byte[]{5, 4, 3, 2, 1, 0, 0, 0, 5, 6, 7})))); AttributeValue av2 = new AttributeValue().withBS(Collections.unmodifiableList( Arrays.asList(ByteBuffer.wrap(new byte[]{5, 4, 3, 2, 1, 0, 0, 0, 5, 6, 7}), ByteBuffer.wrap(new byte[]{0, 1, 2, 3, 4, 5}) ))); assertEquals(av1, av2); ByteBuffer buff1 = marshall(av1); ByteBuffer buff2 = marshall(av2); Assert.assertEquals(buff1, buff2); }
public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); static ByteBuffer marshall(final AttributeValue attributeValue); static AttributeValue unmarshall(final ByteBuffer plainText); }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); static ByteBuffer marshall(final AttributeValue attributeValue); static AttributeValue unmarshall(final ByteBuffer plainText);  }