On Tue, Nov 22, 2016 at 8:35 PM, Paul Read <pdread...@gmail.com> wrote:

> I tried ByteBuffer and it did not like that either.


​I did a quick test and ByteBuffer seems to work fine with the latest
master branch.

The changed classes are as below:

public class TestAvroData {

  private ByteBuffer data;

  public TestAvroData() {
  }

  public void setData(ByteBuffer data) {
    this.data = data;
  }

  public ByteBuffer getData() {
    return this.data;
  }
}

public class TestAvroHelper {
  private AvroHelper<TestAvroData> helper;

  @BeforeClass
  public void setup() {
    helper = new AvroHelper<TestAvroData>(TestAvroData.class);
  }

  @Test
  public void testAvroHelper() throws IOException {

    TestAvroData data = new TestAvroData();
    data.setData(ByteBuffer.wrap("hello".getBytes()));

    byte[] adata = helper.toAvroBytes(data);
    TestAvroData data1 = helper.fromAvroBytes(adata);
    Assert.assertNotNull(data1);
  }
}



*Yibing Shi*
*Customer Operations Engineer*
<http://www.cloudera.com>

Reply via email to