Josh
Native console access wrapper for Java

com.yifanlu.Josh
Class ConsoleScreenBufferInfo

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

public class ConsoleScreenBufferInfo
extends ConsoleAttribute

Contains information about a console screen buffer.

Since:
0.1
Version:
1.3, 05/29/10
Author:
Yifan Lu
See Also:
Windows' CONSOLE_SCREEN_BUFFER_INFO structure, JoshOutBuffer.getConsoleScreenBufferInfo(), JoshOutBuffer.setConsoleScreenBufferInfo(com.yifanlu.Josh.ConsoleScreenBufferInfo)

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
ConsoleScreenBufferInfo(ConsoleCoord size, ConsoleCoord cursorPosition, int attributes, ConsoleSmallRect window, ConsoleCoord maximumWindowSize)
          Creates a new console screen buffer infomation.
 
Method Summary
 boolean equals(java.lang.Object anObject)
          Compares two Objects, if both are ConsoleScreenBufferInfo and have the same values, they are equal.
 ConsoleCoord getCursorPosition()
          Gets the location of the cursor in the buffer info.
 ConsoleCoord getMaximumWindowSize()
          Gets the largest size of the buffer info.
 ConsoleCoord getSize()
          Gets the size of the console buffer in the buffer info.
 ConsoleSmallRect getWindow()
          Gets the size of the window in the buffer info.
 int hashCode()
          Returns a hash code.
 void setCursorPosition(ConsoleCoord cursorPosition)
          Sets the location of the cursor in the buffer info.
 void setMaximumWindowSize(ConsoleCoord maximumWindowSize)
          Sets the largest size of the buffer info.
 void setSize(ConsoleCoord size)
          Sets the size of the console buffer in the buffer info.
 void setWindow(ConsoleSmallRect window)
          Sets the size of the window in the buffer info.
 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

ConsoleScreenBufferInfo

public ConsoleScreenBufferInfo(ConsoleCoord size,
                               ConsoleCoord cursorPosition,
                               int attributes,
                               ConsoleSmallRect window,
                               ConsoleCoord maximumWindowSize)
Creates a new console screen buffer infomation.

Parameters:
size - The size of the console screen buffer, in character columns and rows.
cursorPosition - The column and row coordinates of the cursor in the console screen buffer.
window - The console screen buffer coordinates of the upper-left and lower-right corners of the display window.
attributes - The attributes of the characters written to a screen buffer by the JoshOutBuffer.writeConsoleOutput(com.yifanlu.Josh.ConsoleCharInfo[], com.yifanlu.Josh.ConsoleCoord, com.yifanlu.Josh.ConsoleCoord, com.yifanlu.Josh.ConsoleSmallRect) function, or echoed to a screen buffer by the JoshOutBuffer.readConsoleOutput(com.yifanlu.Josh.ConsoleCoord, com.yifanlu.Josh.ConsoleCoord, com.yifanlu.Josh.ConsoleSmallRect) functions. For more information, see Character Attributes.
maximumWindowSize - The maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size.
Method Detail

getSize

public ConsoleCoord getSize()
Gets the size of the console buffer in the buffer info.

Returns:
The size of the console screen buffer, in character columns and rows.

getCursorPosition

public ConsoleCoord getCursorPosition()
Gets the location of the cursor in the buffer info.

Returns:
The column and row coordinates of the cursor in the console screen buffer.

getWindow

public ConsoleSmallRect getWindow()
Gets the size of the window in the buffer info.

Returns:
The console screen buffer coordinates of the upper-left and lower-right corners of the display window.

getMaximumWindowSize

public ConsoleCoord getMaximumWindowSize()
Gets the largest size of the buffer info.

Returns:
The maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size.

setSize

public void setSize(ConsoleCoord size)
Sets the size of the console buffer in the buffer info.

Parameters:
size - The size of the console screen buffer, in character columns and rows.

setCursorPosition

public void setCursorPosition(ConsoleCoord cursorPosition)
Sets the location of the cursor in the buffer info.

Parameters:
cursorPosition - The column and row coordinates of the cursor in the console screen buffer.

setWindow

public void setWindow(ConsoleSmallRect window)
Sets the size of the window in the buffer info.

Parameters:
window - The console screen buffer coordinates of the upper-left and lower-right corners of the display window.

setMaximumWindowSize

public void setMaximumWindowSize(ConsoleCoord maximumWindowSize)
Sets the largest size of the buffer info.

Parameters:
maximumWindowSize - The maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size.

equals

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

Overrides:
equals in class ConsoleAttribute
Parameters:
anObject - Another ConsoleScreenBufferInfo object.
Returns:
true if all values 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:
The size, the cursor position, the window size, and the maximum window size.

Copyright © 2010 Yifan Lu