org.geotoolkit.io
Enum X364

Object
  extended by Enum<X364>
      extended by X364
All Implemented Interfaces:
Serializable, Comparable<X364>

public enum X364
extends Enum<X364>

Escape codes from ANSI X3.64 standard (aka ECMA-48 and ISO/IEC 6429).

Since:
2.4
Version:
3.12
Author:
Martin Desruisseaux (IRD, Geomatys)
See Also:
ANSI escape codes, Colors
Module:
utility/geotk-utility (download)    View source code for this class

Enum Constant Summary
BACKGROUND_BLUE
          Blue background color, normal intensity.
BACKGROUND_CYAN
          Cyan background color, normal intensity.
BACKGROUND_DEFAULT
          Reset the background color.
BACKGROUND_GRAY
          Gray background color, normal intensity.
BACKGROUND_GREEN
          Green background color, normal intensity.
BACKGROUND_MAGENTA
          Magenta background color, normal intensity.
BACKGROUND_RED
          Red background color, normal intensity.
BACKGROUND_YELLOW
          Yellow background color, normal intensity.
BOLD
          Bold intensity.
FAINT
          Faint intensity.
FOREGROUND_BLUE
          Blue foreground color, normal intensity.
FOREGROUND_CYAN
          Cyan foreground color, normal intensity.
FOREGROUND_DEFAULT
          Reset the foreground color.
FOREGROUND_GRAY
          Gray foreground color, normal intensity.
FOREGROUND_GREEN
          Green foreground color, normal intensity.
FOREGROUND_MAGENTA
          Magenta foreground color, normal intensity.
FOREGROUND_RED
          Red foreground color, normal intensity.
FOREGROUND_YELLOW
          Yellow foreground color, normal intensity.
NORMAL
          Normal intensity (not BOLD).
RESET
          Reset all attributes to their default value.
 
Method Summary
 X364 background()
          Returns the enum for the background color.
 X364 foreground()
          Returns the enum for the foreground color.
static boolean isSupported()
          Returns true if we think that the operating system supports X3.64 sequences.
static int lengthOfPlain(String text)
          Returns the length of the given string without the ANSI escape codes.
static String plain(String text)
          Removes all escape codes from the given string.
 String sequence()
          Returns the X3.64 escape sequence.
static String toHTML(String text)
          Replaces escape codes in the given string by HTML <font> instructions.
static X364 valueOf(String name)
          Returns the enum constant of this type with the specified name.
static X364[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

RESET

public static final X364 RESET
Reset all attributes to their default value.


NORMAL

public static final X364 NORMAL
Normal intensity (not BOLD).


BOLD

public static final X364 BOLD
Bold intensity.


FAINT

public static final X364 FAINT
Faint intensity.


FOREGROUND_RED

public static final X364 FOREGROUND_RED
Red foreground color, normal intensity.


FOREGROUND_GREEN

public static final X364 FOREGROUND_GREEN
Green foreground color, normal intensity.


FOREGROUND_YELLOW

public static final X364 FOREGROUND_YELLOW
Yellow foreground color, normal intensity.


FOREGROUND_BLUE

public static final X364 FOREGROUND_BLUE
Blue foreground color, normal intensity.


FOREGROUND_MAGENTA

public static final X364 FOREGROUND_MAGENTA
Magenta foreground color, normal intensity.


FOREGROUND_CYAN

public static final X364 FOREGROUND_CYAN
Cyan foreground color, normal intensity.


FOREGROUND_GRAY

public static final X364 FOREGROUND_GRAY
Gray foreground color, normal intensity.


FOREGROUND_DEFAULT

public static final X364 FOREGROUND_DEFAULT
Reset the foreground color.


BACKGROUND_RED

public static final X364 BACKGROUND_RED
Red background color, normal intensity.


BACKGROUND_GREEN

public static final X364 BACKGROUND_GREEN
Green background color, normal intensity.


BACKGROUND_YELLOW

public static final X364 BACKGROUND_YELLOW
Yellow background color, normal intensity.


BACKGROUND_BLUE

public static final X364 BACKGROUND_BLUE
Blue background color, normal intensity.


BACKGROUND_MAGENTA

public static final X364 BACKGROUND_MAGENTA
Magenta background color, normal intensity.


BACKGROUND_CYAN

public static final X364 BACKGROUND_CYAN
Cyan background color, normal intensity.


BACKGROUND_GRAY

public static final X364 BACKGROUND_GRAY
Gray background color, normal intensity.


BACKGROUND_DEFAULT

public static final X364 BACKGROUND_DEFAULT
Reset the background color.

Method Detail

values

public static X364[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (X364 c : X364.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static X364 valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

foreground

public X364 foreground()
Returns the enum for the foreground color.

Returns:
The foreground color, or this if this enum is already a foreground color.

background

public X364 background()
Returns the enum for the background color.

Returns:
The background color, or this if this enum is already a background color.

sequence

public String sequence()
Returns the X3.64 escape sequence.

Returns:
The X3.64 escape sequence.

toHTML

public static String toHTML(String text)
Replaces escape codes in the given string by HTML <font> instructions. If no HTML instruction is associated to the given escape code, then the escape sequence is removed.

Parameters:
text - The text with X3.64 sequences.
Returns:
The text with HTML <font> instructions.
Since:
3.12

plain

public static String plain(String text)
Removes all escape codes from the given string.

Parameters:
text - The string which may contains escape codes.
Returns:
Text without the escape codes, or the given text reference if it didn't contained any escape codes.

lengthOfPlain

public static int lengthOfPlain(String text)
Returns the length of the given string without the ANSI escape codes. This is equivalent to plain(text).length() without the cost of creating a temporary string.

Parameters:
text - The string which may contains escape codes.
Returns:
The length of the given string without escape codes.

isSupported

public static boolean isSupported()
Returns true if we think that the operating system supports X3.64 sequences. This method performs a very naive and approximative check. Result is just a hint and may be wrong.

This method does not check if a console is attached to the running JVM because the caller may want to write to the standard error stream instead than the standard output stream, in which case the console information is not applicable.

Returns:
true if we think that the operating system supports X3.64. This method may conservatively returns false in case of doubt.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.