protected static AttributeValue marshallDescription()

in sdk1/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/encryption/DynamoDBEncryptor.java [526:547]


  protected static AttributeValue marshallDescription(Map<String, String> description) {
    try {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      DataOutputStream out = new DataOutputStream(bos);
      out.writeInt(CURRENT_VERSION);
      for (Map.Entry<String, String> entry : description.entrySet()) {
        byte[] bytes = entry.getKey().getBytes(UTF8);
        out.writeInt(bytes.length);
        out.write(bytes);
        bytes = entry.getValue().getBytes(UTF8);
        out.writeInt(bytes.length);
        out.write(bytes);
      }
      out.close();
      AttributeValue result = new AttributeValue();
      result.setB(ByteBuffer.wrap(bos.toByteArray()));
      return result;
    } catch (IOException ex) {
      // Due to the objects in use, an IOException is not possible.
      throw new RuntimeException("Unexpected exception", ex);
    }
  }