Class Out

java.lang.Object
  extended by Out

public class Out
extends java.lang.Object

Simple output to the console and to files.

Copyright (c) 2005 Hanspeter Moessenboeck, University of Linz

This class is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This class is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


This class allows printing formatted data either to the console or to a file. It is intended to be used in an introductory programming course when classes, packages and exceptions are unknown at the beginning. To use it, simply copy Out.class into the current directory.

All output goes to the current output file, which is initially the console. Opening a file with open() makes it the new current output file. Closing a file with close() switches back to the previous output file.


Constructor Summary
Out()
           
 
Method Summary
static void close()
          Close the current output file.
static boolean done()
          Return true if the previous Out operation was successful, otherwise return false.
static void open(java.lang.String fn)
          Open the file with the name fn as the current output file.
static void print(boolean b)
          Print the boolean value b either as "true" or "false".
static void print(char s)
          Print the character value c.
static void print(char[] a)
          Print the character array a.
static void print(double d)
          Print the double value d.
static void print(float f)
          Print the float value f.
static void print(int i)
          Print the integer value i.
static void print(long l)
          Print the long value l.
static void print(java.lang.Object o)
          Print the Object o as resulting from String.valueOf(o).
static void print(java.lang.String s)
          Print the String s.
static void println()
          Terminate the current line by writing a line separator string.
static void println(boolean b)
          Print the boolean value b and terminate the line.
static void println(char s)
          Print the character value c and terminate the line.
static void println(char[] a)
          Print the character array a and terminate the line.
static void println(double d)
          Print the double value d and terminate the line.
static void println(float f)
          Print the float value f and terminate the line.
static void println(int i)
          Print the integer value i and terminate the line.
static void println(long l)
          Print the long value l and terminate the line.
static void println(java.lang.Object o)
          Print the Object o as resulting from String.valueOf(o) and terminate the line.
static void println(java.lang.String s)
          Print the String s and terminate the line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Out

public Out()
Method Detail

done

public static boolean done()
Return true if the previous Out operation was successful, otherwise return false.


print

public static void print(boolean b)
Print the boolean value b either as "true" or "false".


print

public static void print(char s)
Print the character value c.


print

public static void print(int i)
Print the integer value i.


print

public static void print(long l)
Print the long value l.


print

public static void print(float f)
Print the float value f.


print

public static void print(double d)
Print the double value d.


print

public static void print(char[] a)
Print the character array a.


print

public static void print(java.lang.String s)
Print the String s.


print

public static void print(java.lang.Object o)
Print the Object o as resulting from String.valueOf(o).


println

public static void println()
Terminate the current line by writing a line separator string. On windows this is the character sequence '\r' and '\n'


println

public static void println(boolean b)
Print the boolean value b and terminate the line.


println

public static void println(char s)
Print the character value c and terminate the line.


println

public static void println(int i)
Print the integer value i and terminate the line.


println

public static void println(long l)
Print the long value l and terminate the line.


println

public static void println(float f)
Print the float value f and terminate the line.


println

public static void println(double d)
Print the double value d and terminate the line.


println

public static void println(char[] a)
Print the character array a and terminate the line.


println

public static void println(java.lang.String s)
Print the String s and terminate the line.


println

public static void println(java.lang.Object o)
Print the Object o as resulting from String.valueOf(o) and terminate the line.


open

public static void open(java.lang.String fn)
Open the file with the name fn as the current output file. All subsequent output goes to this file until it is closed. The old output file will be restored when the new output file is closed.


close

public static void close()
Close the current output file. The previous output file is restored and becomes the current output file.