本文整理匯總了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();
}
}