All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class rebelsky.io.SimpleOutput

java.lang.Object
   |
   +----rebelsky.io.SimpleOutput

public class SimpleOutput
extends Object
A simple output system for beginning programmers. Permits writing of basic data types without delving into the workings of the various Java libraries. Using this library makes it easier to change programs to do output to a file (hopefully).

While it would be preferable to have this class extend PrintWriter, this makes it difficult to make it work with files (at least in my experience).

Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.

Version:
1.1 of February 1998
Author:
Samuel A. Rebelsky

Constructor Index

o SimpleOutput()
Build an object that can write to standard output.
o SimpleOutput(String)
Build an object that can write to a file.

Method Index

o print(boolean)
Print a boolean (truth) value.
o print(char)
Print a character value.
o print(double)
Print a double value.
o print(double[])
Print an array of doubles.
o print(float)
Print a float value.
o print(int)
Print an integer value.
o print(int[])
Print an array of integer values.
o print(long)
Print a long value.
o print(String)
Print a string value.
o println()
Print a carriage return.
o println(boolean)
Print a boolean (truth) value followed by a carriage return
pre: (none)
post: The value is printlned to the appropriate destination.
o println(char)
Print a character value followed by a carriage return.
o println(double)
Print a double value followed by a carriage return.
o println(double[])
Print an array of double values followed by a carriage return.
o println(float)
Print a float value followed by a carriage return.
o println(int)
Print an integer value followed by a carriage return.
o println(int[])
Print an array of integers followed by a carriage return.
o println(long)
Print a long value followed by a carriage return.
o println(String)
Print a string value followed by a carriage return.
o reset()
Reset the output to standard output.
o setOutput(String)
Set the output to a file.

Constructors

o SimpleOutput
 public SimpleOutput()
Build an object that can write to standard output.
pre: Standard output has not been modified.
post: The returned object writes to standard output.

o SimpleOutput
 public SimpleOutput(String filename)
Build an object that can write to a file. Make sure to call close() when you're done writing to that file. If the file can't be created, exits the program.
pre: The file can be created.
post: The object writes to that file.

Methods

o print
 public void print(boolean b)
Print a boolean (truth) value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(char c)
Print a character value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(double d)
Print a double value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(double doubles[])
Print an array of doubles.
pre: (none)
post: The array is printed to the appropriate destination.

o print
 public void print(int i)
Print an integer value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(int iarr[])
Print an array of integer values.
pre: (none)
post: The array is printed to the appropriate destination in a simplified format.

o print
 public void print(long l)
Print a long value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(float f)
Print a float value.
pre: (none)
post: The value is printed to the appropriate destination.

o print
 public void print(String s)
Print a string value.
pre: (none)
post: The value is printed to the appropriate destination.

o println
 public void println()
Print a carriage return.
pre: (none)
post: A carriage return is printed to the appropriate destination.

o println
 public void println(boolean b)
Print a boolean (truth) value followed by a carriage return
pre: (none)
post: The value is printlned to the appropriate destination.

o println
 public void println(char c)
Print a character value followed by a carriage return.
pre: (none)
post: The value is printlned to the appropriate destination.

o println
 public void println(double d)
Print a double value followed by a carriage return.
pre: (none)
post: The value and a carriage return are printed to the appropriate destination.

o println
 public void println(double doubles[])
Print an array of double values followed by a carriage return.
pre: (none)
post: The value and a carriage return are printed to the appropriate destination.

o println
 public void println(int i)
Print an integer value followed by a carriage return.
pre: (none)
post: The value is printlned to the appropriate destination.

o println
 public void println(int iarr[])
Print an array of integers followed by a carriage return.
pre: (none)
post: The values and a carriage return are printed to the appropriate destination.

o println
 public void println(long l)
Print a long value followed by a carriage return.
pre: (none)
post: The value is printlned to the appropriate destination.

o println
 public void println(float f)
Print a float value followed by a carriage return.
pre: (none)
post: The value is printlned to the appropriate destination.

o println
 public void println(String s)
Print a string value followed by a carriage return.
pre: (none)
post: The value is printlned to the appropriate destination.

o reset
 public void reset()
Reset the output to standard output. Not yet implemented.
pre: (none)
post: The output now goes to standard output.

o setOutput
 public void setOutput(String filename)
Set the output to a file. Make sure to call close() when you're done. If the file can't be created, exits the program.


All Packages  Class Hierarchy  This Package  Previous  Next  Index