/** consume() ahead until p==index; can't just set p=index as we must * update line and charPositionInLine. If we seek backwards, just set p */ @Override public void seek(int index) { if ( index<=p ) { p = index; // just jump; don't update stream state (line, ...) return; } // seek forward, consume until p hits index or n (whichever comes first) index = Math.min(index, n); while ( p<index ) { consume(); } }
@Override public void consume() { input.consume(); }
@Override public void consume() { input.consume(); }
/** consume() ahead until p==index; can't just set p=index as we must * update line and charPositionInLine. If we seek backwards, just set p */ @Override public void seek(int index) { if ( index<=p ) { p = index; // just jump; don't update stream state (line, ...) return; } // seek forward, consume until p hits index or n (whichever comes first) index = Math.min(index, n); while ( p<index ) { consume(); } }
/** consume() ahead until p==index; can't just set p=index as we must * update line and charPositionInLine. If we seek backwards, just set p */ @Override public void seek(int index) { if ( index<=p ) { p = index; // just jump; don't update stream state (line, ...) return; } // seek forward, consume until p hits index or n (whichever comes first) index = Math.min(index, n); while ( p<index ) { consume(); } }
/** consume() ahead until p==index; can't just set p=index as we must * update line and charPositionInLine. If we seek backwards, just set p */ @Override public void seek(int index) { if ( index<=p ) { p = index; // just jump; don't update stream state (line, ...) return; } // seek forward, consume until p hits index or n (whichever comes first) index = Math.min(index, n); while ( p<index ) { consume(); } }
/** consume() ahead until p==index; can't just set p=index as we must * update line and charPositionInLine. If we seek backwards, just set p */ @Override public void seek(int index) { if ( index<=p ) { p = index; // just jump; don't update stream state (line, ...) return; } // seek forward, consume until p hits index or n (whichever comes first) index = Math.min(index, n); while ( p<index ) { consume(); } }