Package org.apache.avro.io

Examples of org.apache.avro.io.Decoder.readString()


    Decoder decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString());

    in = new ByteArrayInputStream(s.getBytes("UTF-8"));
    decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString(new Utf8()).toString());
  }

  @Test
  public void testReadEncoderOutput() throws Exception {
    ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
View Full Code Here


    encoder = new ColumnEncoder(byteOutputStream);
    encoder.writeString("hello there");
    encoder.flush();
    in = new ByteArrayInputStream(byteOutputStream.toByteArray());
    decoder = new ColumnDecoder(in);
    Utf8 readString = decoder.readString(null);
    assertEquals("hello there", readString.toString());
  }
}
View Full Code Here

    byteOutputStream = new ByteArrayOutputStream();
    encoder = new MemcmpEncoder(byteOutputStream);
    encoder.writeString("hello there");
    in = new ByteArrayInputStream(byteOutputStream.toByteArray());
    decoder = new MemcmpDecoder(in);
    Utf8 readString = decoder.readString(null);
    assertEquals("hello there", readString.toString());
  }
}
View Full Code Here

    byteOutputStream = new ByteArrayOutputStream();
    encoder = new MemcmpEncoder(byteOutputStream);
    encoder.writeString("hello there");
    in = new ByteArrayInputStream(byteOutputStream.toByteArray());
    decoder = new MemcmpDecoder(in);
    Utf8 readString = decoder.readString(null);
    assertEquals("hello there", readString.toString());
  }
}
View Full Code Here

  @Test
  public void testReadString() throws Exception {
    String s = "hello";
    InputStream in = new ByteArrayInputStream(s.getBytes("UTF-8"));
    Decoder decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString());

    in = new ByteArrayInputStream(s.getBytes("UTF-8"));
    decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString(new Utf8()).toString());
  }
View Full Code Here

    Decoder decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString());

    in = new ByteArrayInputStream(s.getBytes("UTF-8"));
    decoder = new ColumnDecoder(in);
    assertEquals(s, decoder.readString(new Utf8()).toString());
  }

  @Test
  public void testReadEncoderOutput() throws Exception {
    ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
View Full Code Here

    encoder = new ColumnEncoder(byteOutputStream);
    encoder.writeString("hello there");
    encoder.flush();
    in = new ByteArrayInputStream(byteOutputStream.toByteArray());
    decoder = new ColumnDecoder(in);
    Utf8 readString = decoder.readString(null);
    assertEquals("hello there", readString.toString());
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.