Josh
Native console access wrapper for Java

com.yifanlu.Josh
Class ConsoleCharInfo

java.lang.Object
  extended by com.yifanlu.Josh.ConsoleAttribute
      extended by com.yifanlu.Josh.ConsoleCharInfo

public class ConsoleCharInfo
extends ConsoleAttribute

Specifies a character and its attributes. This structure is used by console functions to read from and write to a console screen buffer.

Since:
0.1
Version:
1.3, 05/29/10
Author:
Yifan Lu
See Also:
Windows' CHAR_INFO structure, JoshOutBuffer

Field Summary
 
Fields inherited from class com.yifanlu.Josh.ConsoleAttribute
attributes, COMMON_LVB_GRID_HORIZONTAL, COMMON_LVB_GRID_LVERTICAL, COMMON_LVB_GRID_RVERTICAL, COMMON_LVB_LEADING_BYTE, COMMON_LVB_REVERSE_VIDEO, COMMON_LVB_TRAILING_BYTE, COMMON_LVB_UNDERSCORE
 
Constructor Summary
ConsoleCharInfo(char character, ConsoleAttribute attribute)
          Creates a new character with attributes.
 
Method Summary
 boolean equals(java.lang.Object anObject)
          Compares two Objects, if both are ConsoleCharInfo and have the same character and attributes, they are equal.
 char getCharacter()
          Gets the char stored in the object.
 int hashCode()
          Returns a hash code.
 void setCharacter(char character)
          Sets the character
 java.lang.String toString()
          A String representation of this object.
 
Methods inherited from class com.yifanlu.Josh.ConsoleAttribute
addAttributes, getAttributes, setAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsoleCharInfo

public ConsoleCharInfo(char character,
                       ConsoleAttribute attribute)
Creates a new character with attributes. An attribute can be a color, or byte change. You can mix and match different attributes with the OR ( | ) operator. For example the attribute ConsoleColor.FOREGROUND_BLUE | ConsoleColor.BACKGROUND_GREEN | ConsoleAttribute.COMMON_LVB_LEADING_BYTE is valid for the int attribute parameter. Note the you can use constants from both ConsoleAttribute and it's subclass ConsoleColor.

Parameters:
character - A char to represent.
attribute - The attribute(s) of the character which can be mixed with the OR operator.
Method Detail

getCharacter

public char getCharacter()
Gets the char stored in the object.

Returns:
The character stored.

setCharacter

public void setCharacter(char character)
Sets the character

Parameters:
character - A char to represent.

equals

public boolean equals(java.lang.Object anObject)
Compares two Objects, if both are ConsoleCharInfo and have the same character and attributes, they are equal.

Overrides:
equals in class ConsoleAttribute
Parameters:
anObject - Another ConsoleCharInfo object.
Returns:
true if both the character and its attributes are equal.

hashCode

public int hashCode()
Returns a hash code.

Overrides:
hashCode in class ConsoleAttribute
Returns:
a hash code value for this object.

toString

public java.lang.String toString()
A String representation of this object.

Overrides:
toString in class ConsoleAttribute
Returns:
A String

Copyright © 2010 Yifan Lu