tribble.net.ftp.shell
Class CommandFile

java.lang.Object
  extended by tribble.net.ftp.shell.CommandFile

 class CommandFile
extends java.lang.Object

FTP source command script. Manages the input stream for a single command script.

Since:
API 1.0, 2007-03-22
Version:
$Revision: 1.3 $ $Date: 2007/03/27 23:54:44 $
Author:
David R. Tribble (david@tribble.com).

Copyright ©2007 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
CommandLexer

Field Summary
(package private)  int m_lineNo
          Source line number of the next input character.
(package private) static java.lang.String REV
          Revision information.
 
Constructor Summary
CommandFile(java.io.Reader in, java.io.PrintWriter out, CommandFile prev)
          Constructor.
 
Method Summary
(package private)  java.lang.String getSourceName()
          Retrieve the name of this source stream (the command script).
(package private)  CommandFile pop()
          Terminate this input source stream.
(package private)  int readChar()
          Read the next input characters from this input source stream.
(package private)  void setSourceName(java.lang.String name)
          Establish the name of this source stream (the command script).
(package private)  void unReadChar(int ch)
          Push back an input character from the source script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

m_lineNo

int m_lineNo
Source line number of the next input character.

Constructor Detail

CommandFile

CommandFile(java.io.Reader in,
            java.io.PrintWriter out,
            CommandFile prev)
Constructor.

Parameters:
in - Input source stream.
out - Error/warning message output stream.
prev - Previous source stream that includes this one.
Since:
1.1, 2007-03-22
Method Detail

setSourceName

void setSourceName(java.lang.String name)
Establish the name of this source stream (the command script).

Parameters:
name - Name of the input stream. This is usually a filename, but it can be any kind of identification for the source stream.
Since:
1.1, 2007-03-22

getSourceName

java.lang.String getSourceName()
Retrieve the name of this source stream (the command script).

Returns:
Name of the input stream. This is usually a filename, but it can be any kind of identification for the source stream.
Since:
1.3, 2007-03-27

pop

CommandFile pop()
Terminate this input source stream.

Returns:
The previous source stream that included this one, or null if this was the first (top-most) source stream. Note that the input stream itself is not closed.
Since:
1.1, 2007-03-22

readChar

int readChar()
       throws java.io.IOException
Read the next input characters from this input source stream. This also updates m_lineNo to reflect the source line number of the returned character.

Each newline (end of line) sequence (CR, LF, CR/LF) is translated into a single newline character ('\n'). A newline character ('\n') is always returned as the last character before the end of the input stream, even if the stream does not contain a final newline sequence.

Returns:
The next character from the input source stream, or '\n' if an end of line (newline) is reached, or -1 if the end of the source stream is reached. Note that the stream is not closed after the end is reached.
Throws:
java.io.IOException
Since:
1.1, 2007-03-22

unReadChar

void unReadChar(int ch)
Push back an input character from the source script.

Since:
1.1, 2007-03-22
See Also:
readChar()