UTF-X, Unit Testing Framework - Xslt

utfx.printers
Class AnsiString

java.lang.Object
  extended by utfx.printers.AnsiString
All Implemented Interfaces:
java.io.Serializable

public class AnsiString
extends java.lang.Object
implements java.io.Serializable

This class represents an ANSI colour escaped string. An ANSI string will produce colour output on terminals that support ANSI colour escaping. Linux console and xterm are examples of such terminals.

Copyright © 2004 - University of Southern Queensland.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.

This program 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.

$Source: /cvs/utf-x/framework/src/java/utfx/printers/AnsiString.java,v $

Version:
$Revision: 1.1 $ $Date: 2005/03/09 03:53:16 $ $Name: release_0_0_8_alpha $
Author:
Jacek Radajewski
See Also:
Serialized Form

Nested Class Summary
static class AnsiString.Colour
           
 
Field Summary
private static boolean ansiColour
          if this is true then the toString() method will return ANSI escaped string.
private static java.lang.String BLUE_ESC
          escape sequence for blue
private  AnsiString.Colour colour
          this strings colour
private static java.lang.String CYAN_ESC
          escape sequence for cyan
private static java.lang.String GREEN_ESC
          escape sequence for green
private static java.lang.String PURPLE_ESC
          escape sequence for purple
private  java.lang.String rawContent
          content of this ANSI string WITHOUT colour escape sequences
private static java.lang.String RED_ESC
          escape sequence for red
private static java.lang.String RESET_ESC
          escape sequence to reset back to the default colour
private static long serialVersionUID
          Comment for serialVersionUID
private static java.lang.String YELLOW_ESC
          escape sequence for yellow
 
Constructor Summary
AnsiString(java.lang.String rawContent, AnsiString.Colour colour)
          Construct a new colour ANSI String.
AnsiString(java.lang.StringBuffer stringBuffer, AnsiString.Colour colour)
          Construct a new colour ANSI String.
 
Method Summary
static void disableAnsiColour()
          method to turn off ANSI escaping.
static void enableAnsiColour()
          method to turn on ANSI escaping.
private  java.lang.String getAnsiString()
           
static void main(java.lang.String[] s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Comment for serialVersionUID

See Also:
Constant Field Values

RED_ESC

private static final java.lang.String RED_ESC
escape sequence for red

See Also:
Constant Field Values

GREEN_ESC

private static final java.lang.String GREEN_ESC
escape sequence for green

See Also:
Constant Field Values

BLUE_ESC

private static final java.lang.String BLUE_ESC
escape sequence for blue

See Also:
Constant Field Values

PURPLE_ESC

private static final java.lang.String PURPLE_ESC
escape sequence for purple

See Also:
Constant Field Values

CYAN_ESC

private static final java.lang.String CYAN_ESC
escape sequence for cyan

See Also:
Constant Field Values

YELLOW_ESC

private static final java.lang.String YELLOW_ESC
escape sequence for yellow

See Also:
Constant Field Values

RESET_ESC

private static final java.lang.String RESET_ESC
escape sequence to reset back to the default colour

See Also:
Constant Field Values

rawContent

private java.lang.String rawContent
content of this ANSI string WITHOUT colour escape sequences


colour

private AnsiString.Colour colour
this strings colour


ansiColour

private static boolean ansiColour
if this is true then the toString() method will return ANSI escaped string. If false than standard, not escaped, raw version of the String will be used.

Constructor Detail

AnsiString

public AnsiString(java.lang.String rawContent,
                  AnsiString.Colour colour)
Construct a new colour ANSI String.

Parameters:
rawContent - string to wrap in ANSI colour
colour - colour ANSI escape sequence to wrap around the string

AnsiString

public AnsiString(java.lang.StringBuffer stringBuffer,
                  AnsiString.Colour colour)
Construct a new colour ANSI String.

Parameters:
stringBuffer - string to wrap in ANSI colour
colour - colour ANSI escape sequence to wrap around the string
Method Detail

disableAnsiColour

public static void disableAnsiColour()
method to turn off ANSI escaping. ON by default.


enableAnsiColour

public static void enableAnsiColour()
method to turn on ANSI escaping. ON by default.


getAnsiString

private java.lang.String getAnsiString()
Returns:
ANSI escaped string.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the content of this ansi string. The returned content will be ANSI colour escaped unless ansiEscape was disabled.

main

public static void main(java.lang.String[] s)

UTF-X, Unit Testing Framework - Xslt