Examples of BinaryDecoder


Examples of org.apache.avro.io.BinaryDecoder

     
      List<ByteBuffer> response =                 // transceive
        getTransceiver().transceive(bbo.getBufferList());
     
      ByteBufferInputStream bbi = new ByteBufferInputStream(response);
      in = new BinaryDecoder(bbi);
    } while (!readHandshake(in));

    // use remote protocol to read response
    m = getRemote().getMessages().get(messageName);
    if (m == null)
View Full Code Here

Examples of org.apache.avro.io.BinaryDecoder

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

Examples of org.apache.avro.io.BinaryDecoder

    writer.write(a, new BinaryEncoder(out));
    AnotherSampleRecord b = new AnotherSampleRecord(10);
    writer.write(b, new BinaryEncoder(out));
    ReflectDatumReader reader = new ReflectDatumReader(schm);
    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

Examples of org.apache.avro.io.BinaryDecoder

    byte[] data = out.toByteArray();

    reader.setSchema(schema);
       
    Object decoded =
      reader.read(null, new BinaryDecoder(new ByteArrayInputStream(data)));
     
    assertEquals("Decoded data does not match.", datum, decoded);
  }
View Full Code Here

Examples of org.apache.avro.io.BinaryDecoder

    +"\"type\":"+schemaJson+", "
    +"\"default\":"+defaultJson+"}]}";
    Schema expected = Schema.parse(recordJson);
    DatumReader in = new GenericDatumReader(ACTUAL, expected);
    GenericData.Record record = (GenericData.Record)
      in.read(null, new BinaryDecoder(new ByteArrayInputStream(new byte[0])));
    assertEquals("Wrong default.", defaultValue, record.get("f"));
    assertEquals("Wrong toString", expected, Schema.parse(expected.toString()));
  }
View Full Code Here

Examples of org.apache.avro.io.BinaryDecoder

    long length = in.length();
    in.seek(length-4);
    int footerSize=(in.read()<<24)+(in.read()<<16)+(in.read()<<8)+in.read();
    in.seek(length-footerSize);
    this.vin = new BinaryDecoder(in);
    long l = vin.readMapStart();
    if (l > 0) {
      do {
        for (long i = 0; i < l; i++) {
          String key = vin.readString(null).toString();
View Full Code Here

Examples of org.apache.avro.io.BinaryDecoder

    transaction.begin();
    Event event = ch.take();
    Assert.assertNotNull(event);

    GenericDatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>(schema);
    BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(event.getBody(), null);
    GenericRecord recordFromEvent = reader.read(null, decoder);
    Assert.assertEquals(msg, recordFromEvent.get("message").toString());

    Map<String, String> hdrs = event.getHeaders();
View Full Code Here

Examples of org.apache.commons.codec.BinaryDecoder

            }
            String authscheme = auth.substring(0, i);
            if (authscheme.equalsIgnoreCase("basic")) {
                String s = auth.substring(i + 1).trim();
                byte[] credsRaw = s.getBytes(HTTP.ASCII);
                BinaryDecoder codec = new Base64();
                try {
                    String creds = new String(codec.decode(credsRaw), HTTP.ASCII);
                    context.setAttribute("creds", creds);
                } catch (DecoderException ex) {
                    throw new ProtocolException("Malformed BASIC credentials");
                }
            }
View Full Code Here

Examples of org.apache.commons.codec.BinaryDecoder

            }
            String authscheme = auth.substring(0, i);
            if (authscheme.equalsIgnoreCase("basic")) {
                String s = auth.substring(i + 1).trim();
                byte[] credsRaw = s.getBytes(HTTP.ASCII);
                BinaryDecoder codec = new Base64();
                try {
                    String creds = new String(codec.decode(credsRaw), HTTP.ASCII);
                    context.setAttribute("creds", creds);
                } catch (DecoderException ex) {
                    throw new ProtocolException("Malformed BASIC credentials");
                }
            }
View Full Code Here

Examples of org.apache.commons.codec.BinaryDecoder

                }
                String authscheme = auth.substring(0, i);
                if (authscheme.equalsIgnoreCase("basic")) {
                    String s = auth.substring(i + 1).trim();
                    byte[] credsRaw = s.getBytes(HTTP.ASCII);
                    BinaryDecoder codec = new Base64();
                    try {
                        String creds = new String(codec.decode(credsRaw), HTTP.ASCII);
                        context.setAttribute("proxy-creds", creds);
                    } catch (DecoderException ex) {
                        throw new ProtocolException("Malformed BASIC credentials");
                    }
                }
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.