Package org.apache.avro.reflect

Examples of org.apache.avro.reflect.ReflectDatumReader


    ByteArrayOutputStream out = new ByteArrayOutputStream();
    SampleRecord record = new SampleRecord();
    record.x = 5;
    record.y = 10;
    writer.write(record, new BinaryEncoder(out));
    ReflectDatumReader reader = new ReflectDatumReader(schm, prefix);
    Object decoded =
      reader.read(null, new BinaryDecoder
                  (new ByteArrayInputStream(out.toByteArray())));
    assertEquals(record, decoded);
  }
View Full Code Here


    // keep record.a null and see if that works
    AnotherSampleRecord a = new AnotherSampleRecord();
    writer.write(a, new BinaryEncoder(out));
    AnotherSampleRecord b = new AnotherSampleRecord(10);
    writer.write(b, new BinaryEncoder(out));
    ReflectDatumReader reader = new ReflectDatumReader(schm, prefix);
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    Object decoded = reader.read(null, new BinaryDecoder(in));
    assertEquals(a, decoded);
    decoded = reader.read(null, new BinaryDecoder(in));
    assertEquals(b, decoded);
  }
View Full Code Here

      readFiles(new SpecificDatumReader("org.apache.avro."));
    }

  @Test
    public void testGeneratedReflect() throws IOException {
      readFiles(new ReflectDatumReader("org.apache.avro."));
    }
View Full Code Here

    write(writer, new FooRecord(10), check);
    write(writer, new BarRecord("Two beers please"), check);
    write(writer, new FooRecord(20), check);
    writer.close();

    ReflectDatumReader din = new ReflectDatumReader("org.apache.avro.");
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    // get one more bar in, just for laughs
    write(writer, new BarRecord("Many beers please"), check);

    writer.close();

    ReflectDatumReader din = new ReflectDatumReader("org.apache.avro.");
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    // null record here, fails when using the default reflectData instance
    write(writer, new BarRecord(), check);
    write(writer, new BarRecord("Two beers please"), check);
    writer.close();

    ReflectDatumReader din = new ReflectDatumReader("org.apache.avro.");
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    write(writer, new FooRecord(10), check);
    write(writer, new BarRecord("Two beers please"), check);
    write(writer, new FooRecord(20), check);
    writer.close();

    ReflectDatumReader din = new ReflectDatumReader();
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    // get one more bar in, just for laughs
    write(writer, new BarRecord("Many beers please"), check);

    writer.close();

    ReflectDatumReader din = new ReflectDatumReader();
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    // null record here, fails when using the default reflectData instance
    write(writer, new BarRecord(), check);
    write(writer, new BarRecord("Two beers please"), check);
    writer.close();

    ReflectDatumReader din = new ReflectDatumReader();
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

    CheckList check = new CheckList();
    write(writer, new BazRecord(10), check);
    write(writer, new BazRecord(20), check);
    writer.close();

    ReflectDatumReader din = new ReflectDatumReader();
    SeekableFileInput sin = new SeekableFileInput(FILE);
    DataFileReader<Object> reader = new DataFileReader<Object>(sin, din);
    Object datum = null;
    long count = reader.getMetaLong("count");
    for (int i = 0; i < count; i++) {
View Full Code Here

TOP

Related Classes of org.apache.avro.reflect.ReflectDatumReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.