KindFTP
© 1998-2001 Joseph Kiniry
© 2001 KindSoftware
All Rights Reserved

kindftp
Class CommandReader

java.lang.Object
  |
  +--kindftp.CommandReader

public class CommandReader
extends java.lang.Object

A line-oriented reader with pushback.


Constructor Summary
CommandReader(java.io.Reader in)
           Create a new command reader.
CommandReader(java.io.Reader in, int size)
           Create a new command reader with a buffer of the given size.
 
Method Summary
 void close()
           Close the stream.
 java.lang.String readLine()
           Read a line of text.
 boolean ready()
           Tell whether this stream is ready to be read.
 void unReadLine(java.lang.String line)
           Unread (pushback) a line of text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandReader

public CommandReader(java.io.Reader in)

Create a new command reader.

Parameters:
in - The reader from which characters will be read.
Preconditions:
in != null

CommandReader

public CommandReader(java.io.Reader in,
                     int size)

Create a new command reader with a buffer of the given size.

Parameters:
in - The reader from which characters will be read.
size - The size of the command reader.
Throws:
java.lang.IllegalArgumentException - if size is <= 0
Preconditions:
in != null
Method Detail

close

public void close()
           throws java.io.IOException

Close the stream.

Throws:
java.io.IOException - If an I/O error occurs.

ready

public boolean ready()
              throws java.io.IOException

Tell whether this stream is ready to be read.

Throws:
java.io.IOException - If an I/O error occurs.

readLine

public java.lang.String readLine()
                          throws java.io.IOException

Read a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Returns:
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached.
Throws:
java.io.IOException - If an I/O error occurs.

unReadLine

public void unReadLine(java.lang.String line)
                throws java.io.IOException

Unread (pushback) a line of text. The line should not be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Parameters:
a - String containing the contents of the line, not including any line-termination characters, to be unread.
Throws:
java.io.IOException - If an I/O error occurs.

KindFTP
© 1998-2001 Joseph Kiniry
© 2001 KindSoftware
All Rights Reserved