![]() |
Java
1.0
|
TextIO provides a set of static methods for reading and writing text. More...
Static Public Member Functions | |
static void | readStandardInput () |
After this method is called, input will be read from standard input (as it is in the default state). More... | |
static void | readStream (InputStream inputStream) |
After this method is called, input will be read from inputStream, provided it is non-null. More... | |
static void | readStream (Reader inputStream) |
After this method is called, input will be read from inputStream, provided it is non-null. More... | |
static void | readFile (String fileName) |
Opens a file with a specified name for input. More... | |
static boolean | readUserSelectedFile () |
Puts a GUI file-selection dialog box on the screen in which the user can select an input file. More... | |
static void | writeStandardOutput () |
After this method is called, output will be written to standard output (as it is in the default state). More... | |
static void | writeStream (OutputStream outputStream) |
After this method is called, output will be sent to outputStream, provided it is non-null. More... | |
static void | writeStream (PrintWriter outputStream) |
After this method is called, output will be sent to outputStream, provided it is non-null. More... | |
static void | writeFile (String fileName) |
Opens a file with a specified name for output. More... | |
static boolean | writeUserSelectedFile () |
Puts a GUI file-selection dialog box on the screen in which the user can select an output file. More... | |
static String | getInputFileName () |
If TextIO is currently reading from a file, then the return value is the name of the file. More... | |
static String | getOutputFileName () |
If TextIO is currently writing to a file, then the return value is the name of the file. More... | |
static void | put (Object x) |
Write a single value to the current output destination, using the default format and no extra spaces. More... | |
static void | put (Object x, int minChars) |
Write a single value to the current output destination, using the default format and outputting at least minChars characters (with extra spaces added before the output value if necessary). More... | |
static void | putln (Object x) |
This is equivalent to put(x), followed by an end-of-line. More... | |
static void | putln (Object x, int minChars) |
This is equivalent to put(x,minChars), followed by an end-of-line. More... | |
static void | putln () |
Write an end-of-line character to the current output destination. More... | |
static void | putf (String format, Object... items) |
Writes formatted output values to the current output destination. More... | |
static boolean | eoln () |
Test whether the next character in the current input source is an end-of-line. More... | |
static boolean | eof () |
Test whether the next character in the current input source is an end-of-file. More... | |
static char | getAnyChar () |
Reads the next character from the current input source. More... | |
static char | peek () |
Returns the next character in the current input source, without actually removing that character from the input. More... | |
static void | skipBlanks () |
Skips over any whitespace characters, except for end-of-lines. More... | |
static byte | getlnByte () |
Skips whitespace characters and then reads a value of type byte from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static short | getlnShort () |
Skips whitespace characters and then reads a value of type short from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static int | getlnInt () |
Skips whitespace characters and then reads a value of type int from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static long | getlnLong () |
Skips whitespace characters and then reads a value of type long from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static float | getlnFloat () |
Skips whitespace characters and then reads a value of type float from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static double | getlnDouble () |
Skips whitespace characters and then reads a value of type double from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static char | getlnChar () |
Skips whitespace characters and then reads a value of type char from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static boolean | getlnBoolean () |
Skips whitespace characters and then reads a value of type boolean from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static String | getlnWord () |
Skips whitespace characters and then reads one "word" from input, discarding the rest of the current line of input (including the next end-of-line character, if any). More... | |
static String | getlnString () |
This is identical to getln(). More... | |
static String | getln () |
Reads all the characters from the current input source, up to the next end-of-line. More... | |
static byte | getByte () |
Skips whitespace characters and then reads a value of type byte from input. More... | |
static short | getShort () |
Skips whitespace characters and then reads a value of type short from input. More... | |
static int | getInt () |
Skips whitespace characters and then reads a value of type int from input. More... | |
static long | getLong () |
Skips whitespace characters and then reads a value of type long from input. More... | |
static char | getChar () |
Skips whitespace characters and then reads a single non-whitespace character from input. More... | |
static float | getFloat () |
Skips whitespace characters and then reads a value of type float from input. More... | |
static double | getDouble () |
Skips whitespace characters and then reads a value of type double from input. More... | |
static String | getWord () |
Skips whitespace characters and then reads one "word" from input. More... | |
static boolean | getBoolean () |
Skips whitespace characters and then reads a value of type boolean from input. More... | |
Static Public Attributes | |
static final char | EOF = (char)0xFFFF |
The value returned by the peek() method when the input is at end-of-file. More... | |
static final char | EOLN = '\n' |
The value returned by the peek() method when the input is at end-of-line. More... | |
Static Private Member Functions | |
static void | skipWhitespace () |
Skips over any whitespace characters, including for end-of-lines. More... | |
static String | readRealString () |
static String | readIntegerString () |
static long | readInteger (long min, long max) |
static void | errorMessage (String message, String expecting) |
static char | lookChar () |
static char | readChar () |
static void | fillBuffer () |
static void | emptyBuffer () |
static void | outputError (String message) |
Static Private Attributes | |
static String | inputFileName |
static String | outputFileName |
static JFileChooser | fileDialog |
static final BufferedReader | standardInput = new BufferedReader(new InputStreamReader(System.in)) |
static final PrintWriter | standardOutput = new PrintWriter(System.out) |
static BufferedReader | in = standardInput |
static PrintWriter | out = standardOutput |
static boolean | readingStandardInput = true |
static boolean | writingStandardOutput = true |
static int | inputErrorCount |
static int | outputErrorCount |
static Matcher | integerMatcher |
static Matcher | floatMatcher |
static final Pattern | integerRegex = Pattern.compile("(\\+|-)?[0-9]+") |
static final Pattern | floatRegex = Pattern.compile("(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?") |
static String | buffer = null |
static int | pos = 0 |
TextIO provides a set of static methods for reading and writing text.
By default, it reads from standard input and writes to standard output, but it is possible to redirect the input and output to files or to other input and output streams. When the standard input and output streams are being used, the input methods will not produce an error; instead, the user is repeatedly prompted for input until a legal input is entered. (If standard input has been changed externally, as by file redirection on the command line, this is not a reasonable behavior; to handle this case, TextIO will give up after 10 consecutive illegal inputs and will throw an IllegalArgumentException.) For the most part, any other error will be translated into an IllegalArguementException.
For writing to standard output, the output methods in this class pretty much duplicate the functionality of System.out, and System.out can be used interchangeably with them.
This class does not use optimal Java programming practices. It is designed specifically to be easily usable even by a beginning programmer who has not yet learned about objects and exceptions. Therefore, everything is in a single source file that compiles into a single class file, all the methods are static methods, and none of the methods throw exceptions that would require try...catch statements. Also for this reason, all exceptions are converted into IllegalArgumentExceptions, even when this exception type doesn't really make sense.
This class requires Java 5.0 or higher. (A previous version of TextIO required only Java 1.1; this version should work with any source code that used the previous version, but it has some new features, including the type of formatted output that was introduced in Java 5 and the ability to use files and streams.)
Definition at line 34 of file TextIO.java.
|
staticprivate |
Definition at line 986 of file TextIO.java.
References buffer.
Referenced by getlnBoolean(), getlnByte(), getlnChar(), getlnDouble(), getlnFloat(), getlnInt(), getlnLong(), getlnShort(), getlnWord(), readFile(), readStandardInput(), readStream(), and readUserSelectedFile().
|
static |
Test whether the next character in the current input source is an end-of-file.
Note that this method does NOT skip whitespace before testing for end-of-line – if you want to do that, call skipBlanks() or skipWhitespace() first.
Definition at line 459 of file TextIO.java.
|
static |
Test whether the next character in the current input source is an end-of-line.
Note that this method does NOT skip whitespace before testing for end-of-line – if you want to do that, call skipBlanks() first.
Definition at line 450 of file TextIO.java.
References peek().
|
staticprivate |
Definition at line 917 of file TextIO.java.
References inputErrorCount, inputFileName, lookChar(), out, readChar(), readingStandardInput, and writingStandardOutput.
Referenced by getBoolean(), getDouble(), getFloat(), and readInteger().
|
staticprivate |
Definition at line 969 of file TextIO.java.
References buffer, floatMatcher, in, inputFileName, integerMatcher, pos, and readingStandardInput.
Referenced by lookChar().
|
static |
Reads the next character from the current input source.
The character can be a whitespace character; compare this to the getChar() method, which skips over whitespace and returns the next non-whitespace character. An end-of-line is always returned as the character '\n', even when the actual end-of-line in the input source is something else, such as '\r' or "\r\n". This method will throw an IllegalArgumentException if the input is at end-of-file (which will not ordinarily happen if reading from standard input).
Definition at line 471 of file TextIO.java.
References readChar().
Referenced by roman.main().
|
static |
Skips whitespace characters and then reads a value of type boolean from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Legal inputs for a boolean input are: true, t, yes, y, 1, false, f, no, n, and 0; letters can be either upper case or lower case. One "word" of input is read, using the getWord() method, and it must be one of these; note that the "word" must be terminated by a whitespace character (or end-of-file).
Definition at line 803 of file TextIO.java.
References errorMessage(), getWord(), and inputErrorCount.
Referenced by getlnBoolean().
|
static |
Skips whitespace characters and then reads a value of type byte from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 661 of file TextIO.java.
References readInteger().
Referenced by getlnByte().
|
static |
Skips whitespace characters and then reads a single non-whitespace character from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error. In other cases, an IllegalArgumentException will be thrown if an end-of-file is encountered.
Definition at line 701 of file TextIO.java.
References readChar(), and skipWhitespace().
Referenced by getlnChar().
|
static |
Skips whitespace characters and then reads a value of type double from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 747 of file TextIO.java.
References errorMessage(), inputErrorCount, and readRealString().
Referenced by getlnDouble().
|
static |
Skips whitespace characters and then reads a value of type float from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 712 of file TextIO.java.
References errorMessage(), inputErrorCount, and readRealString().
Referenced by getlnFloat().
|
static |
If TextIO is currently reading from a file, then the return value is the name of the file.
If the class is reading from standard input or from a stream, then the return value is null.
Definition at line 340 of file TextIO.java.
References inputFileName.
|
static |
Skips whitespace characters and then reads a value of type int from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 681 of file TextIO.java.
References readInteger().
Referenced by getlnInt().
|
static |
Reads all the characters from the current input source, up to the next end-of-line.
The end-of-line is read but is not included in the return value. Any other whitespace characters on the line are retained, even if they occur at the start of input. The return value will be an empty string if there are no no characters before the end-of-line. When using standard IO, this will not produce an error.
In other cases, an IllegalArgumentException will be thrown if an end-of-file is encountered.
Definition at line 645 of file TextIO.java.
References readChar().
Referenced by getlnString(), and roman.main().
|
static |
Skips whitespace characters and then reads a value of type boolean from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Legal inputs for a boolean input are: true, t, yes, y, 1, false, f, no, n, and 0; letters can be either upper case or lower case. One "word" of input is read, using the getWord() method, and it must be one of these; note that the "word" must be terminated by a whitespace character (or end-of-file).
Definition at line 612 of file TextIO.java.
References emptyBuffer(), and getBoolean().
|
static |
Skips whitespace characters and then reads a value of type byte from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 524 of file TextIO.java.
References emptyBuffer(), and getByte().
|
static |
Skips whitespace characters and then reads a value of type char from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
Note that the value that is returned will be a non-whitespace character; compare this with the getAnyChar() method. When using standard IO, this will not produce an error. In other cases, an error can occur if an end-of-file is encountered.
Definition at line 597 of file TextIO.java.
References emptyBuffer(), and getChar().
|
static |
Skips whitespace characters and then reads a value of type double from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 584 of file TextIO.java.
References emptyBuffer(), and getDouble().
|
static |
Skips whitespace characters and then reads a value of type float from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 572 of file TextIO.java.
References emptyBuffer(), and getFloat().
|
static |
Skips whitespace characters and then reads a value of type int from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 548 of file TextIO.java.
References emptyBuffer(), and getInt().
Referenced by roman.main().
|
static |
Skips whitespace characters and then reads a value of type long from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 560 of file TextIO.java.
References emptyBuffer(), and getLong().
|
static |
Skips whitespace characters and then reads a value of type short from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 536 of file TextIO.java.
References emptyBuffer(), and getShort().
|
static |
|
static |
Skips whitespace characters and then reads one "word" from input, discarding the rest of the current line of input (including the next end-of-line character, if any).
A word is defined as a sequence of non-whitespace characters (not just letters!). When using standard IO, this will not produce an error. In other cases, an IllegalArgumentException will be thrown if an end-of-file is encountered.
Definition at line 625 of file TextIO.java.
References emptyBuffer(), and getWord().
|
static |
Skips whitespace characters and then reads a value of type long from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 691 of file TextIO.java.
References readInteger().
Referenced by getlnLong().
|
static |
If TextIO is currently writing to a file, then the return value is the name of the file.
If the class is writing to standard output or to a stream, then the return value is null.
Definition at line 349 of file TextIO.java.
References outputFileName.
|
static |
Skips whitespace characters and then reads a value of type short from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. When using standard IO, this will not produce an error; the user will be prompted repeatedly for input until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found.
Definition at line 671 of file TextIO.java.
References readInteger().
Referenced by getlnShort().
|
static |
Skips whitespace characters and then reads one "word" from input.
Any additional characters on the current line of input are retained, and will be read by the next input operation. A word is defined as a sequence of non-whitespace characters (not just letters!). When using standard IO, this will not produce an error. In other cases, an IllegalArgumentException will be thrown if an end-of-file is encountered.
Definition at line 783 of file TextIO.java.
References EOF, lookChar(), readChar(), and skipWhitespace().
Referenced by getBoolean(), and getlnWord().
|
staticprivate |
Definition at line 946 of file TextIO.java.
References buffer, EOF, fillBuffer(), and pos.
Referenced by errorMessage(), getWord(), peek(), readChar(), readIntegerString(), readRealString(), skipBlanks(), and skipWhitespace().
|
staticprivate |
Definition at line 990 of file TextIO.java.
References outputErrorCount, outputFileName, and writingStandardOutput.
|
static |
Returns the next character in the current input source, without actually removing that character from the input.
The character can be a whitespace character and can be the end-of-file character (specified by the constant TextIO.EOF).An end-of-line is always returned as the character '\n', even when the actual end-of-line in the input source is something else, such as '\r' or "\r\n". This method never causes an error.
Definition at line 482 of file TextIO.java.
References lookChar().
Referenced by eof(), eoln(), and roman.main().
|
static |
Write a single value to the current output destination, using the default format and no extra spaces.
This method will handle any type of parameter, even one whose type is one of the primitive types.
Definition at line 361 of file TextIO.java.
References out, and outputError().
Referenced by roman.main(), and putln().
|
static |
Write a single value to the current output destination, using the default format and outputting at least minChars characters (with extra spaces added before the output value if necessary).
This method will handle any type of parameter, even one whose type is one of the primitive types.
x | The value to be output, which can be of any type. |
minChars | The minimum number of characters to use for the output. If x requires fewer then this number of characters, then extra spaces are added to the front of x to bring the total up to minChars. If minChars is less than or equal to zero, then x will be printed in the minumum number of spaces possible. |
Definition at line 379 of file TextIO.java.
References out, and outputError().
|
static |
Writes formatted output values to the current output destination.
This method has the same function as System.out.printf(); the details of formatted output are not discussed here. The first parameter is a string that describes the format of the output. There can be any number of additional parameters; these specify the values to be output and can be of any type. This method will throw an IllegalArgumentException if the format string is null or if the format string is illegal for the values that are being output.
Definition at line 429 of file TextIO.java.
References out, and outputError().
|
static |
Write an end-of-line character to the current output destination.
Definition at line 413 of file TextIO.java.
References out, and outputError().
|
static |
This is equivalent to put(x), followed by an end-of-line.
Definition at line 392 of file TextIO.java.
References out, and outputError().
Referenced by roman.main().
|
static |
This is equivalent to put(x,minChars), followed by an end-of-line.
Definition at line 402 of file TextIO.java.
References out, outputError(), and put().
|
staticprivate |
Definition at line 957 of file TextIO.java.
References buffer, inputFileName, lookChar(), pos, and readingStandardInput.
Referenced by errorMessage(), getAnyChar(), getChar(), getln(), getWord(), skipBlanks(), and skipWhitespace().
|
static |
Opens a file with a specified name for input.
If the file name is null, this has the same effect as calling readStandardInput(); that is, input will be read from standard input. If an error occurs while trying to open the file, an exception of type IllegalArgumentException is thrown, and the input source is not changed. If the file is opened successfully, then after this method is called, all of the input routines will read from the file, instead of from standard input.
Definition at line 117 of file TextIO.java.
References emptyBuffer(), in, inputErrorCount, inputFileName, readingStandardInput, and readStandardInput().
|
staticprivate |
Definition at line 886 of file TextIO.java.
References errorMessage(), inputErrorCount, and readIntegerString().
Referenced by getByte(), getInt(), getLong(), and getShort().
|
staticprivate |
Definition at line 870 of file TextIO.java.
References buffer, EOF, integerMatcher, integerRegex, lookChar(), pos, and skipWhitespace().
Referenced by readInteger().
|
staticprivate |
Definition at line 854 of file TextIO.java.
References buffer, EOF, floatMatcher, floatRegex, lookChar(), pos, and skipWhitespace().
Referenced by getDouble(), and getFloat().
|
static |
After this method is called, input will be read from standard input (as it is in the default state).
If a file or stream was previously the input source, that file or stream is closed.
Definition at line 59 of file TextIO.java.
References emptyBuffer(), in, inputErrorCount, inputFileName, readingStandardInput, and standardInput.
Referenced by readFile(), readStream(), and TextIOApplet.ProgRun.run().
|
static |
After this method is called, input will be read from inputStream, provided it is non-null.
If inputStream is null, then this method has the same effect as calling readStandardInput(); that is, future input will come from the standard input stream.
Definition at line 80 of file TextIO.java.
References readStandardInput().
|
static |
After this method is called, input will be read from inputStream, provided it is non-null.
If inputStream is null, then this method has the same effect as calling readStandardInput(); that is, future input will come from the standard input stream.
Definition at line 93 of file TextIO.java.
References emptyBuffer(), in, inputErrorCount, inputFileName, readingStandardInput, and readStandardInput().
|
static |
Puts a GUI file-selection dialog box on the screen in which the user can select an input file.
If the user cancels the dialog instead of selecting a file, it is not considered an error, but the return value of the subroutine is false. If the user does select a file, but there is an error while trying to open the file, then an exception of type IllegalArgumentException is thrown. Finally, if the user selects a file and it is successfully opened, then the return value of the subroutine is true, and the input routines will read from the file, instead of from standard input. If the user cancels, or if any error occurs, then the previous input source is not changed.
NOTE: Calling this method starts a GUI user interface thread, which can continue to run even if the thread that runs the main program ends. If you use this method in a non-GUI program, it might be necessary to call System.exit(0) at the end of the main() routine to shut down the Java virtual machine completely.
Definition at line 159 of file TextIO.java.
References emptyBuffer(), fileDialog, in, inputErrorCount, inputFileName, and readingStandardInput.
|
static |
Skips over any whitespace characters, except for end-of-lines.
After this method is called, the next input character is either an end-of-line, an end-of-file, or a non-whitespace character. This method never causes an error. (Ordinarily, end-of-file is not possible when reading from standard input.)
Definition at line 492 of file TextIO.java.
References EOF, lookChar(), and readChar().
|
staticprivate |
Skips over any whitespace characters, including for end-of-lines.
After this method is called, the next input character is either an end-of-file or a non-whitespace character. This method never causes an error. (Ordinarily, end-of-file is not possible when reading from standard input.)
Definition at line 506 of file TextIO.java.
References EOF, lookChar(), out, readChar(), readingStandardInput, and writingStandardOutput.
Referenced by getChar(), getWord(), readIntegerString(), and readRealString().
|
static |
Opens a file with a specified name for output.
If the file name is null, this has the same effect as calling writeStandardOutput(); that is, output will be sent to standard output. If an error occurs while trying to open the file, an exception of type IllegalArgumentException is thrown. If the file is opened successfully, then after this method is called, all of the output routines will write to the file, instead of to standard output. If an error occurs, the output destination is not changed.
NOTE: Calling this method starts a GUI user interface thread, which can continue to run even if the thread that runs the main program ends. If you use this method in a non-GUI program, it might be necessary to call System.exit(0) at the end of the main() routine to shut down the Java virtual machine completely.
Definition at line 254 of file TextIO.java.
References out, outputErrorCount, outputFileName, writeStandardOutput(), and writingStandardOutput.
|
static |
After this method is called, output will be written to standard output (as it is in the default state).
If a file or stream was previously open for output, it will be closed.
Definition at line 195 of file TextIO.java.
References out, outputErrorCount, outputFileName, standardOutput, and writingStandardOutput.
Referenced by TextIOApplet.ProgRun.run(), writeFile(), and writeStream().
|
static |
After this method is called, output will be sent to outputStream, provided it is non-null.
If outputStream is null, then this method has the same effect as calling writeStandardOutput(); that is, future output will be sent to the standard output stream.
Definition at line 216 of file TextIO.java.
References writeStandardOutput().
|
static |
After this method is called, output will be sent to outputStream, provided it is non-null.
If outputStream is null, then this method has the same effect as calling writeStandardOutput(); that is, future output will be sent to the standard output stream.
Definition at line 229 of file TextIO.java.
References out, outputErrorCount, outputFileName, writeStandardOutput(), and writingStandardOutput.
|
static |
Puts a GUI file-selection dialog box on the screen in which the user can select an output file.
If the user cancels the dialog instead of selecting a file, it is not considered an error, but the return value of the subroutine is false. If the user does select a file, but there is an error while trying to open the file, then an exception of type IllegalArgumentException is thrown. Finally, if the user selects a file and it is successfully opened, then the return value of the subroutine is true, and the output routines will write to the file, instead of to standard output. If the user cancels, or if an error occurs, then the current output destination is not changed.
Definition at line 291 of file TextIO.java.
References fileDialog, out, outputErrorCount, outputFileName, and writingStandardOutput.
|
staticprivate |
Definition at line 851 of file TextIO.java.
Referenced by emptyBuffer(), fillBuffer(), lookChar(), readChar(), readIntegerString(), and readRealString().
|
static |
The value returned by the peek() method when the input is at end-of-file.
(The value of this constant is (char)0xFFFF.)
Definition at line 45 of file TextIO.java.
Referenced by eof(), getWord(), lookChar(), readIntegerString(), readRealString(), skipBlanks(), and skipWhitespace().
|
static |
The value returned by the peek() method when the input is at end-of-line.
The value of this constant is the character '\n'.
Definition at line 51 of file TextIO.java.
|
staticprivate |
Definition at line 832 of file TextIO.java.
Referenced by readUserSelectedFile(), and writeUserSelectedFile().
|
staticprivate |
Definition at line 847 of file TextIO.java.
Referenced by fillBuffer(), and readRealString().
|
staticprivate |
Definition at line 849 of file TextIO.java.
Referenced by readRealString().
|
staticprivate |
Definition at line 837 of file TextIO.java.
Referenced by fillBuffer(), readFile(), readStandardInput(), readStream(), and readUserSelectedFile().
|
staticprivate |
Definition at line 843 of file TextIO.java.
Referenced by errorMessage(), getBoolean(), getDouble(), getFloat(), readFile(), readInteger(), readStandardInput(), readStream(), and readUserSelectedFile().
|
staticprivate |
Definition at line 829 of file TextIO.java.
Referenced by errorMessage(), fillBuffer(), getInputFileName(), readChar(), readFile(), readStandardInput(), readStream(), and readUserSelectedFile().
|
staticprivate |
Definition at line 846 of file TextIO.java.
Referenced by fillBuffer(), and readIntegerString().
|
staticprivate |
Definition at line 848 of file TextIO.java.
Referenced by readIntegerString().
|
staticprivate |
Definition at line 838 of file TextIO.java.
Referenced by errorMessage(), put(), putf(), putln(), skipWhitespace(), writeFile(), writeStandardOutput(), writeStream(), and writeUserSelectedFile().
|
staticprivate |
Definition at line 844 of file TextIO.java.
Referenced by outputError(), writeFile(), writeStandardOutput(), writeStream(), and writeUserSelectedFile().
|
staticprivate |
Definition at line 830 of file TextIO.java.
Referenced by getOutputFileName(), outputError(), writeFile(), writeStandardOutput(), writeStream(), and writeUserSelectedFile().
|
staticprivate |
Definition at line 852 of file TextIO.java.
Referenced by fillBuffer(), lookChar(), readChar(), readIntegerString(), and readRealString().
|
staticprivate |
Definition at line 840 of file TextIO.java.
Referenced by errorMessage(), fillBuffer(), readChar(), readFile(), readStandardInput(), readStream(), readUserSelectedFile(), and skipWhitespace().
|
staticprivate |
Definition at line 834 of file TextIO.java.
Referenced by readStandardInput().
|
staticprivate |
Definition at line 835 of file TextIO.java.
Referenced by writeStandardOutput().
|
staticprivate |
Definition at line 841 of file TextIO.java.
Referenced by errorMessage(), outputError(), skipWhitespace(), writeFile(), writeStandardOutput(), writeStream(), and writeUserSelectedFile().