예제 #1
0
 public void read(Object record, Decoder dec) throws IOException {
   Object reuseObj = null;
   if (_reuse) {
     _recordAccess.getField(record, _field.getName(), _field.getPos());
   }
   _recordAccess.addField(
       record, _field.getName(), _field.getPos(), _itemReader.read(reuseObj, dec));
 }
예제 #2
0
  private ItemReader resolveRecord(RecordSchema schema) {
    ItemReader recordReader = _recordReaders.get(schema);
    if (recordReader != null) {
      return recordReader;
    }

    RecordAccess recordAccess = getRecordAccess(schema);
    List<FieldReader> fieldReaders = new ArrayList<FieldReader>();
    recordReader = new RecordReader(recordAccess, fieldReaders);
    _recordReaders.put(schema, recordReader);

    for (Field field : schema) {
      ItemReader itemReader = resolveReader(field.getSchema());
      boolean reuse = isReusable(field.getSchema().getType());
      FieldReader fieldReader = new FieldReader(field, recordAccess, itemReader, reuse);
      fieldReaders.add(fieldReader);
    }

    return recordReader;
  }