@Override public void close() throws IOException { super.close(); }
@Override public boolean hasNext() { if ( iter != null && iter.hasNext() ) { return true; } else { if (locations != null && !(inputSplit instanceof StringSplit) && currIndex < locations.length-1 ) { currIndex++; try { close(); iter = IOUtils.lineIterator(new InputStreamReader(locations[currIndex].toURL().openStream())); } catch (IOException e) { e.printStackTrace(); } return iter.hasNext(); } return false; } }
@Override public Collection<Writable> next() { List<Writable> ret = new ArrayList<>(); if(iter.hasNext()) { String record = iter.next(); invokeListeners(record); ret.add(new Text(record)); return ret; } else { if ( !(inputSplit instanceof StringSplit) && currIndex < locations.length-1 ) { currIndex++; try { close(); iter = IOUtils.lineIterator(new InputStreamReader(locations[currIndex].toURL().openStream())); } catch (IOException e) { e.printStackTrace(); } if(iter.hasNext()) { String record = iter.next(); invokeListeners(record); ret.add(new Text(record)); return ret; } } throw new NoSuchElementException("No more elements found!"); } }
@Override public Collection<Writable> next() { List<Writable> ret = new ArrayList<>(); if(iter.hasNext()) { ret.add(new Text(iter.nextLine())); return ret; } else { currIndex++; try { close(); iter = IOUtils.lineIterator(new InputStreamReader(locations[currIndex].toURL().openStream())); } catch (IOException e) { e.printStackTrace(); } if(iter.hasNext()) { ret.add(new Text(iter.nextLine())); return ret; } } throw new NoSuchElementException("No more elements found!"); }