Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created August 21, 2013 14:52
Show Gist options
  • Select an option

  • Save emaxerrno/6295510 to your computer and use it in GitHub Desktop.

Select an option

Save emaxerrno/6295510 to your computer and use it in GitHub Desktop.
@Override
public boolean next(K key, V value) throws IOException {
if (eof) {
return false;
}
if (firstRecord) { // key & value are already read.
firstRecord = false;
return true;
}
try {
if (realReader.nextKeyValue()) {
if (key != realReader.getCurrentKey()) {
throw new IOException("DeprecatedInputFormatWrapper can not "
+ "support RecordReaders that don't return same key & value "
+ "objects. current reader class : " + realReader.getClass());
}
if (value != realReader.getCurrentValue()) {
if (null != valueCopier)
valueCopier.copyValue(value, realReader.getCurrentValue());
else {
throw new IOException("DeprecatedInputFormatWrapper - value is different "
+ "and no value copier provided. "
+ "current reader class : " + realReader.getClass());
}
}
return true;
}
} catch (InterruptedException e) {
throw new IOException(e);
}
eof = true; // strictly not required, just for consistency
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment