本文整理汇总了Java中org.apache.avro.generic.GenericData.get方法的典型用法代码示例。如果您正苦于以下问题:Java GenericData.get方法的具体用法?Java GenericData.get怎么用?Java GenericData.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.generic.GenericData
的用法示例。
在下文中一共展示了GenericData.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AvroDataStreamParser
import org.apache.avro.generic.GenericData; //导入方法依赖的package包/类
public AvroDataStreamParser(
ProtoConfigurableEntity.Context context,
Schema schema,
String streamName,
InputStream inputStream,
long recordCount,
int maxObjectLength
) throws IOException {
this.context = context;
avroSchema = schema;
this.streamName = streamName;
this.recordCount = recordCount;
datumReader = new GenericDatumReader<>(avroSchema, avroSchema, GenericData.get()); //Reader schema argument is optional
overrunInputStream = new OverrunInputStream(inputStream, maxObjectLength, true);
dataFileStream = new DataFileStream<>(overrunInputStream, datumReader);
seekToOffset();
}
示例2: AvroDataFileParser
import org.apache.avro.generic.GenericData; //导入方法依赖的package包/类
public AvroDataFileParser(ProtoConfigurableEntity.Context context, Schema schema, File file, String readerOffset, int maxObjectLength)
throws IOException {
this.context = context;
this.file = file;
DatumReader<GenericRecord> datumReader = new GenericDatumReader<>(schema, schema, GenericData.get());
sin = new SeekableOverrunFileInputStream(
new FileInputStream(file), maxObjectLength, true);
dataFileReader = new DataFileReader<>(sin, datumReader);
if(readerOffset != null && !readerOffset.isEmpty() && !"0".equals(readerOffset)) {
String[] split = readerOffset.split(OFFSET_SEPARATOR);
if(split.length == 3) {
//split[0] is the file name
previousSync = Long.parseLong(split[1]);
recordCount = Long.parseLong(split[2]);
seekToOffset();
} else if (split.length == 2) {
previousSync = Long.parseLong(split[0]);
recordCount = Long.parseLong(split[1]);
seekToOffset();
} else {
throw new IllegalArgumentException(Utils.format("Invalid offset {}", readerOffset));
}
} else {
recordCount = 0;
previousSync = dataFileReader.previousSync();
}
}