Ejemplo n.º 1
0
 @Override
 protected boolean doProcess(Record record) {
   if (preserveExisting
       && record.getFields().containsKey(fieldName)) {; // we must preserve the existing id
   } else {
     record.replaceValues(fieldName, generateUUID());
   }
   return super.doProcess(record);
 }
Ejemplo n.º 2
0
    @Override
    protected boolean doProcess(Record inputRecord, InputStream stream) throws IOException {
      if (counter++ % 8192 == 0) {
        clob = new StringBuilder(); // periodically gc memory from large outlier strings
      }
      incrementNumRecords();
      Charset detectedCharset = detectCharset(inputRecord, charset);
      Reader reader = new InputStreamReader(stream, detectedCharset);
      clob.setLength(0);
      int len;
      while ((len = reader.read(buffer)) >= 0) {
        clob.append(buffer, 0, len);
      }
      Record outputRecord = inputRecord.copy();
      removeAttachments(outputRecord);
      outputRecord.replaceValues(Fields.MESSAGE, clob.toString());

      // pass record to next command in chain:
      return getChild().process(outputRecord);
    }