Package org.apache.avro.io

Examples of org.apache.avro.io.EncoderFactory


    return this;
  }

  private void init(OutputStream outs) throws IOException {
    this.out = new BufferedFileOutputStream(outs);
    EncoderFactory efactory = new EncoderFactory();
    this.vout = efactory.binaryEncoder(out, null);
    dout.setSchema(schema);
    buffer = new NonCopyingByteArrayOutputStream(
        Math.min((int)(syncInterval * 1.25), Integer.MAX_VALUE/2 -1));
    this.bufOut = efactory.binaryEncoder(buffer, null);
    if (this.codec == null) {
      this.codec = CodecFactory.nullCodec().createInstance();
    }
    this.isOpen = true;
  }
View Full Code Here


  private static <T> byte[] render(T datum, Schema schema,
                               DatumWriter<T> writer)
    throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    writer.setSchema(schema);
    Encoder enc = new EncoderFactory().directBinaryEncoder(out, null);
    writer.write(datum, enc);
    enc.flush();
    return out.toByteArray();
  }
View Full Code Here

      this.writer = writer;
    }

    public void open(OutputStream out) {
      this.out = out;
      this.encoder = new EncoderFactory().configureBlockSize(512)
          .binaryEncoder(out, null);
    }
View Full Code Here

  }

  @Test
  public void test() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    EncoderFactory factory = EncoderFactory.get();
    Encoder e = factory.validatingEncoder(schema,
        factory.binaryEncoder(baos, null));
   
    ResolvingGrammarGenerator.encode(e, schema, data);
    e.flush();
  }
View Full Code Here

    }

    @Override
    public void open(OutputStream out) throws IOException {
      this.out = out;
      this.encoder = new EncoderFactory().configureBlockSize(512).binaryEncoder(out, null);
    }
View Full Code Here

      this.writer = writer;
    }

    public void open(OutputStream out) {
      this.out = out;
      this.encoder = new EncoderFactory().configureBlockSize(512).binaryEncoder(out, null);
    }
View Full Code Here

      saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg");
      saved.location = $("Los Altos, CA");
      saved.password = ByteBuffer.wrap($("").getBytes());
      FileOutputStream fos = new FileOutputStream(file);

      BinaryEncoder be = new EncoderFactory().binaryEncoder(fos, null);
      SpecificDatumWriter<User> sdw = new SpecificDatumWriter<User>(User.class);
      sdw.write(saved, be);
      be.flush();
      fos.close();
    }
View Full Code Here

//      saved.title = $("Engineer");
      saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg");
//      saved.location = $("Los Altos, CA");
      saved.password = ByteBuffer.wrap($("").getBytes());
      FileOutputStream fos = new FileOutputStream(file);
      BinaryEncoder be = new EncoderFactory().binaryEncoder(fos, null);
      SpecificDatumWriter<User> sdw = new SpecificDatumWriter<User>(User.class);
      sdw.write(saved, be);
      be.flush();
      fos.close();
    }
View Full Code Here

      this.writer = writer;
    }

    public void open(OutputStream out) {
      this.out = out;
      this.encoder = new EncoderFactory().configureBlockSize(512).binaryEncoder(out, null);
    }
View Full Code Here

  private final BinaryEncoder wrappedEncoder;
  private final OutputStream out;

  public ColumnEncoder(OutputStream out) {
    this.out = out;
    wrappedEncoder = new EncoderFactory().binaryEncoder(out, null);
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.io.EncoderFactory

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.