braju.com
Java printf & scanf (beta)

com.braju.beta.lang
Class CharacterVariable

java.lang.Object
  |
  +--com.braju.beta.lang.CharacterVariable
All Implemented Interfaces:
Variable

public final class CharacterVariable
extends java.lang.Object
implements Variable

Wraps a char and provides methods to convert the value to and from several datatypes [JDK1.0.2 compatible].


Field Summary
static int ALIGN_CENTER
          When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the center.
static int ALIGN_LEFT
          When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the left.
static int ALIGN_RIGHT
          When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the right.
static int LEADING_ZEROS
          When converting a character to a string with a specified minimum width, this constant says that the result should be filled up width leading zero, i.e.
static int NO_FLAGS
          When converting a character to a string with specified minimum width, this constant says that the default format should be used [...].
static java.lang.Class TYPE
          The class of this static object [...].
 
Constructor Summary
CharacterVariable()
           
CharacterVariable(char ch)
          Wraps a character into an object just like java.lang.Character does, but provides some additional methods.
 
Method Summary
 char charValue()
          Get the character.
 java.lang.Object get()
           
static void main(java.lang.String[] args)
           
static CharacterVariable[] newArray(int length)
          Creates an array of length instance of this class.
 void set(char ch)
          Set a new value [...].
 void set(java.lang.Object o)
           
static java.lang.String toEscapeString(char value)
          Convert a character into a readible escape-String, e.g.
static java.lang.String toEscapeString(char value, int minWidth, int flags)
          Convert a character into a readible escape-String, e.g.
 java.lang.String toString()
          Return the wrapped character as a String.
static java.lang.String toString(char ch)
          Convert a character into a string.
static java.lang.String toString(char ch, int minWidth, int flags)
          Convert a character into a string with specified minimum width and alignment according to the flags-parameter [...].
static java.lang.String toUTFString(char value)
          Convert a character into a readible UTF-String, e.g.
static java.lang.String toUTFString(char value, int minWidth, int flags)
          Convert a character into a readible UTF-String, e.g.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_FLAGS

public static final int NO_FLAGS
When converting a character to a string with specified minimum width, this constant says that the default format should be used [...]. See also ALIGN_LEFT, ALIGN_CENTER and ALIGN_RIGHT.

ALIGN_LEFT

public static final int ALIGN_LEFT
When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the left.

ALIGN_CENTER

public static final int ALIGN_CENTER
When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the center.

ALIGN_RIGHT

public static final int ALIGN_RIGHT
When converting a character to a string with specified minimum width, this constant says that the result should be aligned to the right.

LEADING_ZEROS

public static final int LEADING_ZEROS
When converting a character to a string with a specified minimum width, this constant says that the result should be filled up width leading zero, i.e. no spaces.

TYPE

public static final java.lang.Class TYPE
The class of this static object [...]. Provides a convenient way to check or compare the type.
Constructor Detail

CharacterVariable

public CharacterVariable()

CharacterVariable

public CharacterVariable(char ch)
Wraps a character into an object just like java.lang.Character does, but provides some additional methods.
Method Detail

newArray

public static CharacterVariable[] newArray(int length)
Creates an array of length instance of this class.

set

public void set(char ch)
Set a new value [...]. This is better than creating a new object all the time.

set

public void set(java.lang.Object o)
Specified by:
set in interface Variable

get

public java.lang.Object get()
Specified by:
get in interface Variable

charValue

public char charValue()
Get the character.

toString

public static java.lang.String toString(char ch)
Convert a character into a string.

toString

public static java.lang.String toString(char ch,
                                        int minWidth,
                                        int flags)
Convert a character into a string with specified minimum width and alignment according to the flags-parameter [...]. Provides an easy way to align a boolean to the left, the right och to the center. If flags is given the value NO_FLAGS then the result is aligned to the left. By also specifing LEADING_ZEROS you can add '0's to left of the character.

toString

public java.lang.String toString()
Return the wrapped character as a String.
Overrides:
toString in class java.lang.Object

toUTFString

public static java.lang.String toUTFString(char value)
Convert a character into a readible UTF-String, e.g. "\\u0048".

toUTFString

public static java.lang.String toUTFString(char value,
                                           int minWidth,
                                           int flags)
Convert a character into a readible UTF-String, e.g. "\\u0048", with specified minimum width and alignment according to the flags-parameter [...]. Provides an easy way to align a string to the left, the right och to the center. If flags is given the value NO_FLAGS then the string is aligned to the left.

toEscapeString

public static java.lang.String toEscapeString(char value)
Convert a character into a readible escape-String, e.g. "\\n", with specified minimum width and alignment according to the flags-parameter [...]. Only '\\n', '\\r' and '\\t' are taken care of.

toEscapeString

public static java.lang.String toEscapeString(char value,
                                              int minWidth,
                                              int flags)
Convert a character into a readible escape-String, e.g. "\\n" [...]. Only '\\n', '\\r' and '\\t' are taken care of.

main

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

braju.com
Java printf & scanf (beta)

Copyright 1997-2000, Henrik Bengtsson.