Package org.apache.avro.io

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


        Schema effectiveSchema = possibleTypes.get(unionIndex);
        if (effectiveSchema.getType() == Type.NULL) {
          decoder.readNull();
          return null;
        } else {
          data = decoder.readBytes(null).array();
        }
      } catch (IOException e) {
        e.printStackTrace();
        throw new GoraException("Error decoding union type: ", e);
      }
View Full Code Here


        Schema effectiveSchema = possibleTypes.get(unionIndex);
        if (effectiveSchema.getType() == Type.NULL) {
          decoder.readNull();
          return null;
        } else {
          data = decoder.readBytes(null).array();
        }
      } catch (IOException e) {
        e.printStackTrace();
        throw new GoraException("Error decoding union type: ", e);
      }
View Full Code Here

  @Test
  public void testReadBytes() throws Exception {
    InputStream in = new ByteArrayInputStream(new byte[] { (byte) 0x06,
        (byte) 0x01, (byte) 0x00, (byte) 0xff });
    Decoder decoder = new ColumnDecoder(in);
    ByteBuffer bytes = decoder.readBytes(null);
    assertArrayEquals(new byte[]{(byte) 0x01, (byte) 0x00, (byte) 0xff},
        bytes.array());
  }

  @Test
View Full Code Here

  @Test
  public void testReadBytes() throws Exception {
    InputStream in = new ByteArrayInputStream(new byte[] { (byte) 0x01,
        (byte) 0x00, (byte) 0x01, (byte) 0xff, (byte) 0x00, (byte) 0x00 });
    Decoder decoder = new MemcmpDecoder(in);
    ByteBuffer bytes = decoder.readBytes(null);
    assertArrayEquals(new byte[] { (byte) 0x01, (byte) 0x00, (byte) 0xff },
        bytes.array());
  }

  @Test
View Full Code Here

  @Test
  public void testReadBytes() throws Exception {
    InputStream in = new ByteArrayInputStream(new byte[] { (byte) 0x01,
        (byte) 0x00, (byte) 0x01, (byte) 0xff, (byte) 0x00, (byte) 0x00 });
    Decoder decoder = new MemcmpDecoder(in);
    ByteBuffer bytes = decoder.readBytes(null);
    assertArrayEquals(new byte[] { (byte) 0x01, (byte) 0x00, (byte) 0xff },
        bytes.array());
  }

  @Test
View Full Code Here

  @Test
  public void testReadBytes() throws Exception {
    InputStream in = new ByteArrayInputStream(new byte[] { (byte) 0x06,
        (byte) 0x01, (byte) 0x00, (byte) 0xff });
    Decoder decoder = new ColumnDecoder(in);
    ByteBuffer bytes = decoder.readBytes(null);
    assertArrayEquals(new byte[]{(byte) 0x01, (byte) 0x00, (byte) 0xff},
        bytes.array());
  }

  @Test
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.