@Override protected void handleClose() throws IOException { try { super.handleClose(); } finally { nextElement = null; } }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }
/** * Calls {@link #handleClose()} upon first call and makes sure this method gets called only once. */ @Override public final void close() throws IOException { if (closed.compareAndSet(false, true)) { handleClose(); } else { handleAlreadyClosed(); } }
@Override protected void handleClose() throws IOException { try { // Close this iteration, this will prevent lookAhead() from calling // getNextElement() again super.handleClose(); } finally { Iterators.close(currentIter); } } }
@Override protected E getNextElement() { if (currentIter.hasNext()) { return currentIter.next(); } // Current Iterator exhausted, continue with the next one Iterators.closeSilently(currentIter); if (argIter.hasNext()) { currentIter = argIter.next().iterator(); } else { // All elements have been returned return null; } return getNextElement(); }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }
/** * Calls {@link #handleClose()} upon first call and makes sure this method gets called only once. */ @Override public final void close() throws IOException { if (closed.compareAndSet(false, true)) { handleClose(); } else { handleAlreadyClosed(); } }
@Override protected void handleClose() throws IOException { try { super.handleClose(); } finally { nextElement = null; } }
@Override protected void handleClose() throws IOException { try { // Close this iteration, this will prevent lookAhead() from calling // getNextElement() again super.handleClose(); } finally { Iterators.close(currentIter); } } }
@Override protected E getNextElement() { if (currentIter.hasNext()) { return currentIter.next(); } // Current Iterator exhausted, continue with the next one Iterators.closeSilently(currentIter); if (argIter.hasNext()) { currentIter = argIter.next().iterator(); } else { // All elements have been returned return null; } return getNextElement(); }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }
/** * Calls {@link #handleClose()} upon first call and makes sure this method gets called only once. */ @Override public final void close() throws IOException { if (closed.compareAndSet(false, true)) { handleClose(); } else { handleAlreadyClosed(); } }
@Override protected void handleClose() throws IOException { try { super.handleClose(); } finally { nextElement = null; } }
@Override protected void handleClose() throws IOException { try { // Close this iteration, this will prevent lookAhead() from calling // getNextElement() again super.handleClose(); } finally { Iterators.close(currentIter); } } }