se.entra.phantom.server
Class BinaryTrace

java.lang.Object
  extended by se.entra.phantom.server.BinaryTrace

public class BinaryTrace
extends Object

This class is used to trace binary data to an output stream.


Field Summary
static String[] monthNames
          The month names.
 
Constructor Summary
BinaryTrace()
           
 
Method Summary
static void dump(ClientConnectionData client, byte[] buf)
           
static void dump(ClientConnectionData client, byte[] buf, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, byte[] buf, int length)
           
static void dump(ClientConnectionData client, byte[] buf, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, byte[] buf, int startingPosition, int length)
           
static void dump(ClientConnectionData client, byte[] buf, int startingPosition, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, short[] buf)
           
static void dump(ClientConnectionData client, short[] buf, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, short[] buf, int length)
           
static void dump(ClientConnectionData client, short[] buf, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, short[] buf, int startingPosition, int length)
           
static void dump(ClientConnectionData client, short[] buf, int startingPosition, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header)
           
static void dump(ClientConnectionData client, String[] headers)
           
static void dump(ClientConnectionData client, String header, byte[] buf)
           
static void dump(ClientConnectionData client, String header, byte[] buf, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header, byte[] buf, int length)
           
static void dump(ClientConnectionData client, String header, byte[] buf, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header, byte[] buf, int startingPosition, int length)
           
static void dump(ClientConnectionData client, String header, byte[] buf, int startingPosition, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header, short[] buf)
           
static void dump(ClientConnectionData client, String header, short[] buf, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header, short[] buf, int length)
           
static void dump(ClientConnectionData client, String header, short[] buf, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String header, short[] buf, int startingPosition, int length)
           
static void dump(ClientConnectionData client, String header, short[] buf, int startingPosition, int length, boolean isEBCDIC)
           
static void dump(ClientConnectionData client, String mainHeading, String[] headers)
           
static void errPrint(String text)
          Prints a line of text to stderr even if redirection is present.
static void errPrintln(String text)
          Prints a line of text to stderr even if redirection is present.
static String formatDate(Date date)
          Formats the Date instance to a string that is used by the dump methods in this class as well as other event logs in NetPhantom.
static String getCurrentTime()
           
static long getMaximumFileSize()
          Gets the maximum file size of a trace file.
static String getThousandFormattedNumber(int nn)
          Gets a thousand-formatted positive number.
static String getThousandFormattedNumber(long nn)
          Gets a thousand-formatted positive number.
static long getTraceFileLength()
          Gets the current trace file length.
static String getTraceFileName()
          The current trace file name.
static void print(String text)
          Prints a line of text to the screen even if redirection is present.
static void println(String text)
          Prints a line of text to the screen even if redirection is present.
static boolean rotateTraceFiles()
          Changes the trace files.
static boolean setMaximumFileSize(long size)
          Sets the maximum file size of a trace file.
static void setScreenOutputRedirection(boolean redirect)
          Redirects stdout and stderr to trace file, or restores the original settings.
static void setTraceFileName(String fn)
          Sets the trace file name.
static void setTraceFileName(String fn, boolean doAppend)
          Sets the trace file name.
static void setupTraceFileNames(String fn1, String fn2)
          Sets up the two file names used when rotating trace files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monthNames

public static final String[] monthNames
The month names.

Constructor Detail

BinaryTrace

public BinaryTrace()
Method Detail

getCurrentTime

public static String getCurrentTime()

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf,
                        int startingPosition,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        short[] buf,
                        int startingPosition,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        short[] buf,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        short[] buf,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf,
                        int startingPosition,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf,
                        int startingPosition,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf,
                        int length,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf,
                        boolean isEBCDIC)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf,
                        int startingPosition,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        short[] buf,
                        int startingPosition,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        short[] buf,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        short[] buf)

dump

public static void dump(ClientConnectionData client,
                        short[] buf)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf,
                        int startingPosition,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf,
                        int startingPosition,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf,
                        int length)

dump

public static void dump(ClientConnectionData client,
                        String header,
                        byte[] buf)

dump

public static void dump(ClientConnectionData client,
                        byte[] buf)

dump

public static void dump(ClientConnectionData client,
                        String header)

dump

public static void dump(ClientConnectionData client,
                        String[] headers)

dump

public static void dump(ClientConnectionData client,
                        String mainHeading,
                        String[] headers)

setupTraceFileNames

public static void setupTraceFileNames(String fn1,
                                       String fn2)
Sets up the two file names used when rotating trace files. Note that this method doesn't check if the file names are identical, it is assumed that they aren't.

Note: No assignment of file name for tracing is done at this poiint, call setTraceFileName in order to perform this.


setTraceFileName

public static void setTraceFileName(String fn)
                             throws IOException
Sets the trace file name. If file name is null, the standard output System.out will be used.

Throws:
IOException - if an I/O error occurs.

setTraceFileName

public static void setTraceFileName(String fn,
                                    boolean doAppend)
                             throws IOException
Sets the trace file name. If file name is null, the standard output System.out will be used.

Throws:
IOException - if an I/O error occurs.

getTraceFileName

public static String getTraceFileName()
The current trace file name.

Returns:
null if no trace file has been set.

getTraceFileLength

public static long getTraceFileLength()
Gets the current trace file length.

Returns:
-1 if no file is used.

rotateTraceFiles

public static boolean rotateTraceFiles()
Changes the trace files.

Returns:
false for failure, true for success.

setMaximumFileSize

public static boolean setMaximumFileSize(long size)
Sets the maximum file size of a trace file. If set to zero, no limit is used.

Returns:
true successful, false for invalid size (100 KB minimum [102400]).

getMaximumFileSize

public static long getMaximumFileSize()
Gets the maximum file size of a trace file. If set to zero, no limit is used.


formatDate

public static String formatDate(Date date)
Formats the Date instance to a string that is used by the dump methods in this class as well as other event logs in NetPhantom.


getThousandFormattedNumber

public static String getThousandFormattedNumber(int nn)
Gets a thousand-formatted positive number.


getThousandFormattedNumber

public static String getThousandFormattedNumber(long nn)
Gets a thousand-formatted positive number.


setScreenOutputRedirection

public static void setScreenOutputRedirection(boolean redirect)
Redirects stdout and stderr to trace file, or restores the original settings. The output, if redirected, is placed in the trace files.


print

public static void print(String text)
Prints a line of text to the screen even if redirection is present.


println

public static void println(String text)
Prints a line of text to the screen even if redirection is present.


errPrint

public static void errPrint(String text)
Prints a line of text to stderr even if redirection is present.


errPrintln

public static void errPrintln(String text)
Prints a line of text to stderr even if redirection is present.



Phantom® and NetPhantom® are registered trademarks of Codectica Systems SARL.
© Copyright Codectica Systems SARL, 2008. All rights reserved.