Main Page
    Cookbook/Overview     ImageMeister     the jcprops file     Licensing
    Binary Installation & Configuration [ Win · Mac · Nix · OSX ]     Changes
    Public API
    Source Code Main Page
        Java [ Common · Win · Mac · Nix ]     Native Code [ Common · Win · Mac · Nix ]     Manifest
        Native Code Overviews [ Common · Win · Mac · Nix · Strings ]     Macros [ General · Native Macros ]
        Walkthroughs [ Java only · Java and native ]     Building [ Win · Mac · Nix · OSX ]     Distribution Issues

All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.jconfig.Trace
java.lang.Object
   |
   +----com.jconfig.Trace

  Summary

public class  Trace
     extends java.lang.Object
{
          // Fields 3
     public static final int TRACE_FILE;
     public static final int TRACE_NULL;
     public static final int TRACE_SYSOUT;

          // Methods 4
     public static PrintStream getOut();
     public static void println(String);
     public static void setDestination(int);
     public static void setOut(PrintStream);

}

Used to write debugging messages.

This class maintains a PrintStream object; the println() method writes a line of text to this stream, and the getOut() method returns the PrintStream object.

Initially, the PrintStream object is null, meaning that all output will be discarded. If the PrintStream object is null, the 'getOut' method will return a PrintStream which discards all input.

Using the setDestination() method, you can indicate that output should be:

For example, if you want to direct all calls to Trace.println() to System.out, use:

	Trace.setDestination( Trace.TRACE_SYSOUT );
If you want to direct all calls to Trace.println() to a file, use:
	PrintStream		myStream;

	myStream = new PrintStream( new FileOutputStream( new File( curDir, "myfile.txt" ) ) );

	Trace.setOut( outStream );
	Trace.setDestination( Trace.TRACE_FILE );

The setDestination() method takes precedence over the setOut() method; that is, if you call setOut() with a PrintStream, followed by setDestination( Trace.TRACE_NULL ), all output will be discarded. However, the PrintStream you passed to setOut() will be saved, so if you subsequently call setDestination( Trace.TRACE_FILE ), output will be sent to the PrintStream.

Author:
Copyright (c) 1997-2002 Samizdat Productions. All Rights Reserved.




  Fields

· TRACE_SYSOUT

Summary  |  Top

   public static final int TRACE_SYSOUT

See the setDestination() method


· TRACE_FILE

Summary  |  Top
   public static final int TRACE_FILE

See the setDestination() method


· TRACE_NULL

Summary  |  Top
   public static final int TRACE_NULL

See the setDestination() method


  Methods

· setDestination

Summary  |  Top

   public static void setDestination(int d) 


· println

Summary  |  Top
   public static void println(String s) 

Print the given string to the current PrintStream.



· setOut

Summary  |  Top
   public static void setOut(PrintStream o) 

Sets the PrintStream to which output of the 'println' method will be sent.

Parameter Description
o the new PrintStream object. If this is null, any data sent to the 'println' method will be discarded, and the 'getOut' method will return a PrintStream object which discards all input.



· getOut

Summary  |  Top
   public static PrintStream getOut() 

Returns the current PrintStream object.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7