List of usage examples for org.apache.hadoop.io LongWritable set
public void set(long value)
From source file:StorageEngineClient.MultiFormatStorageRecordReader.java
License:Open Source License
@Override public boolean next(LongWritable key, IRecord value) throws IOException { if (paths == null || paths.length == 0 || ifdf == null) return false; key.set(currentrecnum++); if (ifdf.next(value)) return true; while (++currentFile < paths.length) { ifdf.close();/*w w w .ja v a 2 s . c o m*/ ifdf = new IFormatDataFile(conf); ifdf.open(paths[currentFile].toString()); ifdf.seek(0); if (ifdf.next(value)) return true; } return false; }
From source file:StorageEngineClient.MyLineRecordReader.java
License:Open Source License
public synchronized boolean next(LongWritable key, Text value) throws IOException { while (pos < end) { key.set(pos); int newSize; try {//from ww w. j a v a 2 s. co m newSize = in.readLine(value, maxLineLength, Math.max((int) Math.min(Integer.MAX_VALUE, end - pos), maxLineLength)); if (newSize == 0) { return false; } pos += newSize; if (newSize < maxLineLength) { return true; } LOG.info("Skipped line of size " + newSize + " at pos " + (pos - newSize)); } catch (IOException e) { if (tempSplit != null) { LOG.info(""); if (tempSplit.getPath() != null) { String filePath = tempSplit.getPath().toUri().toString(); String ioeMsg = "The file " + filePath + " maybe is broken, please check it!"; throw new IOException(ioeMsg); } else { if (tempConf != null && tempConf instanceof JobConf) { if (tempConf.get("map.input.file") != null && tempConf.get("map.input.file") != "") { String filePath = tempConf.get("map.input.file"); String ioeMsg = "The file " + filePath + " maybe is broken, please check it!"; throw new IOException(ioeMsg); } } } } throw e; } } return false; }