@Override public boolean next(Value target) throws IOException { try { target.read(input); } catch (EOFException ex) { return false; } return true; }
/* (non-Javadoc) * @see eu.stratosphere.pact.common.recordio.OutputFormat#writeRecord(eu.stratosphere.pact.common.type.PactRecord) */ @Override public void writeRecord(PactRecord record) throws IOException { int numRecFields = record.getNumFields(); int readPos; for (int i = 0; i < this.numFields; i++) { readPos = this.recordPositions[i]; if (readPos < numRecFields) { Value v = record.getField(this.recordPositions[i], this.classes[i]); if (v != null) { if (i != 0) this.wrt.write(this.fieldDelimiter); this.wrt.write(v.toString()); } else { if (this.lenient) { if (i != 0) this.wrt.write(this.fieldDelimiter); } else { throw new RuntimeException( "Cannot serialize record with <null> value at position: " + readPos); } } } else { if (this.lenient) { if (i != 0) this.wrt.write(this.fieldDelimiter); } else { throw new RuntimeException( "Cannot serialize record with out field at position: " + readPos); } } } // add the record delimiter this.wrt.write(this.recordDelimiter); }