type.util
Class PrintStream2

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by type.util.PrintStream2
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class PrintStream2
extends java.io.PrintStream

This class emmulates part of the functionality of the printf method in PrintStream in J2SE 5.

Version:
1.0 (Summer 2004)
Author:
H. Roumani, roumani@cs.yorku.ca

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
PrintStream2(java.io.File file)
          Creates a new print stream, without automatic line flushing, with the specified file.
PrintStream2(java.io.File file, java.lang.String csn)
          Creates a new print stream, without automatic line flushing, with the specified file and charset.
PrintStream2(java.io.OutputStream out)
          Create a new print stream.
PrintStream2(java.io.OutputStream out, boolean autoFlush)
          Create a new print stream.
PrintStream2(java.io.OutputStream out, boolean autoFlush, java.lang.String encoding)
          Create a new print stream.
PrintStream2(java.lang.String fileName)
          Creates a new print stream, without automatic line flushing, with the specified file name.
PrintStream2(java.lang.String fileName, java.lang.String csn)
          Creates a new print stream, without automatic line flushing, with the specified file name and charset.
 
Method Summary
 java.io.PrintStream printf(java.lang.String format, double value)
          Write the passed double value to this output stream using the passed formatting string.
 java.io.PrintStream printf(java.lang.String format, int value)
          Write the passed integer value to this output stream using the passed formatting string.
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintStream2

public PrintStream2(java.io.File file)
             throws java.io.FileNotFoundException
Creates a new print stream, without automatic line flushing, with the specified file.

Throws:
java.io.FileNotFoundException

PrintStream2

public PrintStream2(java.io.File file,
                    java.lang.String csn)
             throws java.io.FileNotFoundException,
                    java.io.UnsupportedEncodingException
Creates a new print stream, without automatic line flushing, with the specified file and charset.

Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException

PrintStream2

public PrintStream2(java.io.OutputStream out)
Create a new print stream.


PrintStream2

public PrintStream2(java.io.OutputStream out,
                    boolean autoFlush)
Create a new print stream.


PrintStream2

public PrintStream2(java.io.OutputStream out,
                    boolean autoFlush,
                    java.lang.String encoding)
             throws java.io.UnsupportedEncodingException
Create a new print stream.

Throws:
java.io.UnsupportedEncodingException

PrintStream2

public PrintStream2(java.lang.String fileName)
             throws java.io.FileNotFoundException
Creates a new print stream, without automatic line flushing, with the specified file name.

Throws:
java.io.FileNotFoundException

PrintStream2

public PrintStream2(java.lang.String fileName,
                    java.lang.String csn)
             throws java.io.FileNotFoundException,
                    java.io.UnsupportedEncodingException
Creates a new print stream, without automatic line flushing, with the specified file name and charset.

Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
Method Detail

printf

public java.io.PrintStream printf(java.lang.String format,
                                  int value)
Write the passed integer value to this output stream using the passed formatting string.

Parameters:
format - the format string. It must contain exactly one format specifier that begins with % and ends with d.
value - the value to be formatted and printed
Returns:
this print stream

printf

public java.io.PrintStream printf(java.lang.String format,
                                  double value)
Write the passed double value to this output stream using the passed formatting string.

Parameters:
format - the format string. It must contain exactly one format specifier that begins with % and ends with f.
value - the value to be formatted and printed
Returns:
this print stream


Java by Abstraction: A Client-View Approach