congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.apache.avro.io
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.avro.io

Best Java code snippets using org.apache.avro.io (Showing top 20 results out of 1,791)

origin: apache/nifi

@Override
protected GenericRecord nextAvroRecord() throws IOException {
  if (decoder.isEnd()) {
    return null;
  }
  try {
    genericRecord = datumReader.read(genericRecord, decoder);
  } catch (final EOFException eof) {
    return null;
  }
  return genericRecord;
}
origin: apache/avro

@Override
public void setItemCount(long itemCount) throws IOException {
 super.setItemCount(itemCount);
 out.setItemCount(itemCount);
}
origin: apache/avro

BinaryDecoder configure(byte[] data, int offset, int length) {
 configureSource(DecoderFactory.DEFAULT_BUFFER_SIZE, new ByteArrayByteSource(
   data, offset, length));
 return this;
}
origin: apache/flink

  /**
   * Writes given record using specified schema.
   * @param record record to serialize
   * @param schema schema to use for serialization
   * @return serialized record
   */
  public static byte[] writeRecord(GenericRecord record, Schema schema) throws IOException {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(stream, null);

    new GenericDatumWriter<>(schema).write(record, encoder);
    encoder.flush();
    return stream.toByteArray();
  }
}
origin: apache/flink

@Override public void readExternal(java.io.ObjectInput in)
 throws java.io.IOException {
 READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
}
origin: apache/avro

@Override
public ByteBuffer readBytes(ByteBuffer old) throws IOException {
 int length = readInt();
 return byteReader.read(old, length);
}
origin: apache/avro

private void ensureBounds(int l) throws IOException {
 while (buf.length < (pos + l)) {
  if (blockStack[stackTop].state == BlockedValue.State.REGULAR) {
   compact();
  } else {
   super.writeFixed(buf, 0, pos);
   pos = 0;
  }
 }
}
origin: apache/avro

BlockingBinaryEncoder configure(OutputStream out, int blockBufferSize,
  int binaryEncoderBufferSize) {
 super.configure(out, binaryEncoderBufferSize);
 pos = 0;
 stackTop = 0;
 if (null == buf || buf.length != blockBufferSize) {
  buf = new byte[blockBufferSize];
 }
 assert check();
 return this;
}
origin: apache/avro

@Override
protected Decoder getDecoder() throws IOException {
 return new ResolvingDecoder(schema, readerSchema, super.getDecoder());
}
@Override
origin: apache/avro

@Override
public void writeLong(long n) throws IOException {
 ensureBounds(10);
 pos += BinaryData.encodeLong(n, buf, pos);
}
origin: apache/avro

@Override
public void writeInt(int n) throws IOException {
 ensureBounds(5);
 pos += BinaryData.encodeInt(n, buf, pos);
}
origin: apache/avro

@Override
public void writeBoolean(boolean b) throws IOException {
 ensureBounds(1);
 pos += BinaryData.encodeBoolean(b, buf, pos);
}
origin: apache/avro

@Override
public void writeDouble(double d) throws IOException {
 ensureBounds(8);
 pos += BinaryData.encodeDouble(d, buf, pos);
}
origin: apache/avro

@Override
public void writeIndex(int unionIndex) throws IOException {
 ensureBounds(5);
 pos += BinaryData.encodeInt(unionIndex, buf, pos);
}
origin: apache/avro

@Override
public void writeFloat(float f) throws IOException {
 ensureBounds(4);
 pos += BinaryData.encodeFloat(f, buf, pos);
}
origin: apache/avro

@Override
protected Decoder getDecoder() throws IOException {
 return new ValidatingDecoder(schema, super.getDecoder());
}
@Override
origin: apache/avro

@Override
void genSourceData() {
 Random r = newRandom();
 sourceData = new Rec[count];
 for (int i = 0; i < sourceData.length; i++) {
  sourceData[i] = new Rec(r);
 }
}
@Override
origin: apache/avro

@Override
void genSourceData() {
 Random r = newRandom();
 sourceData = new Object[count];
 for (int i = 0; i < sourceData.length; i++) {
  sourceData[i] = genSingleRecord(r);
 }
 reuse = genSingleRecord(r);
}
origin: apache/flink

@Override public void readExternal(java.io.ObjectInput in)
 throws java.io.IOException {
 READER$.read(this, SpecificData.getDecoder(in));
}
origin: apache/flink

@Override public void readExternal(java.io.ObjectInput in)
 throws java.io.IOException {
 READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
}
org.apache.avro.io

Most used classes

  • DecoderFactory
    A factory for creating and configuring Decoders. Factories are thread-safe, and are generally cached
  • EncoderFactory
    A factory for creating and configuring Encoder instances. Factory methods that create Encoder instan
  • DatumWriter
    Write data of a schema.Implemented for different in-memory data representations.
  • DatumReader
    Read data of a schema.Determines the in-memory data representation.
  • BinaryEncoder
    An abstract Encoder for Avro's binary encoding. To construct and configure instances, use EncoderFac
  • JsonEncoder,
  • BinaryDecoder,
  • Decoder,
  • ResolvingDecoder,
  • BinaryData,
  • JsonDecoder,
  • ResolvingGrammarGenerator,
  • ValidatingDecoder,
  • JsonGrammarGenerator,
  • Parser,
  • Symbol$Alternative,
  • Symbol$EnumLabelsAction,
  • DirectBinaryDecoder,
  • ParsingEncoder
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now