com.sun.enterprise.admin.cli
Class Pager

java.lang.Object
  extended by com.sun.enterprise.admin.cli.Pager

 class Pager
extends Object

Pager.java

Author:
Toby H Ferguson

Field Summary
private  BufferedReader in
           
private  String line
           
private  BufferedWriter out
           
private  int pageLength
           
 
Constructor Summary
Pager(int lines, Reader in, Writer out)
          Construct an object which will copy one pages worth of lines at a time from the input to the the output.
 
Method Summary
(package private)  boolean hasNext()
          Indicate if there are lines left to be copied
private  void nextLine()
          Get the next line and copy it inot the internal buffer so's we can answer the hasNext() question
(package private)  void nextPage()
          Copy the next page worth of lines from input to output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private BufferedReader in

out

private BufferedWriter out

pageLength

private int pageLength

line

private String line
Constructor Detail

Pager

Pager(int lines,
      Reader in,
      Writer out)
throws IOException
Construct an object which will copy one pages worth of lines at a time from the input to the the output. No attempt is made under any circumstances to close the input or output.

Parameters:
lines - the number of lines in a page. A number less than 0 means copy all the input to the output.
in - the source of the copy operation
out - the destination of the copy operation
Throws:
IOException - if there's a problem reading from, or writing to, the source or destination
Method Detail

nextPage

void nextPage()
        throws IOException
Copy the next page worth of lines from input to output

Throws:
IOException

hasNext

boolean hasNext()
Indicate if there are lines left to be copied

Returns:
true iff there is at least one line left to be copied

nextLine

private void nextLine()
               throws IOException
Get the next line and copy it inot the internal buffer so's we can answer the hasNext() question

Throws:
IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.