|
Josh Native console access wrapper for Java |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.yifanlu.Josh.JoshBuffer
com.yifanlu.Josh.JoshOutBuffer
public class JoshOutBuffer
Provides native access to the output buffer.
This allows direct manipulation of the console screen buffer.
Objects from this class are immutable.
| Field Summary | |
|---|---|
static int |
ENABLE_ECHO_INPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_INSERT_MODE
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_LINE_INPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_MOUSE_INPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_PROCESSED_INPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_PROCESSED_OUTPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_QUICK_EDIT_MODE
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_WINDOW_INPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
static int |
ENABLE_WRAP_AT_EOL_OUTPUT
Used in getConsoleMode() and setConsoleMode(int) to modify the console mode. |
| Constructor Summary | |
|---|---|
JoshOutBuffer(ConsoleHandle handle)
Creates a new output buffer for direct manipulation of the output buffer. |
|
| Method Summary | |
|---|---|
void |
fillConsoleOutputAttribute(ConsoleCoord coord,
int length,
ConsoleAttribute attribute)
Sets the character attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer. |
void |
fillConsoleOutputCharacter(ConsoleCoord coord,
int length,
char character)
Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates. |
ConsoleCursorInfo |
getConsoleCursorInfo()
Retrieves information about the size and visibility of the cursor for the specified console screen buffer. |
ConsoleCoord |
getConsoleFontSize()
XP Only: Retrieves the size of the font used by the specified console screen buffer. |
int |
getConsoleMode()
Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer. |
ConsoleScreenBufferInfo |
getConsoleScreenBufferInfo()
Retrieves information about the specified console screen buffer. |
ConsoleFontInfo |
getCurrentConsoleFont(boolean forMaximumWindowSize)
XP Only: Retrieves information about the current console font. |
ConsoleCoord |
getLargestConsoleWindowSize()
Retrieves the size of the largest possible console window, based on the current font and the size of the display. |
ConsoleCharInfo[] |
readConsoleOutput(ConsoleCoord size,
ConsoleCoord coord,
ConsoleSmallRect readRegion)
Reads character and color attribute data from a rectangular block of character cells in a console screen buffer, and the function writes the data to a rectangular block at a specified location in the destination buffer. |
ConsoleAttribute[] |
readConsoleOutputAttribute(ConsoleCoord coord,
int length)
Reads a specified number of character attributes from consecutive cells of a console screen buffer, beginning at a specified location. |
char[] |
readConsoleOutputChar(ConsoleCoord coord,
int length)
Reads a number of characters from consecutive cells of a console screen buffer, beginning at a specified location. |
void |
scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleCoord destination)
Moves a block of data in a screen buffer without a clip block or intersection fill. |
void |
scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleCoord destination,
ConsoleCharInfo fill)
Moves a block of data in a screen buffer without a clip block. |
void |
scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleSmallRect clip,
ConsoleCoord destination,
ConsoleCharInfo fill)
Moves a block of data in a screen buffer. |
void |
setConsoleCursorInfo(ConsoleCursorInfo info)
Sets the size and visibility of the cursor for the specified console screen buffer. |
void |
setConsoleCursorPosition(ConsoleCoord cursorPosition)
Sets the cursor position in the specified console screen buffer. |
void |
setConsoleMode(int flags)
Sets the input mode of a console's input buffer or the output mode of a console screen buffer. |
void |
setConsoleScreenBufferInfo(ConsoleScreenBufferInfo info)
Vista Only: Sets extended information about the specified console screen buffer. |
void |
setConsoleTextAttribute(ConsoleAttribute attribute)
Sets the attributes of characters written or echoed to the console screen buffer. |
void |
setConsoleWindowInfo(boolean absolute,
ConsoleSmallRect newSize)
Sets the current size and position of a console screen buffer's window. |
void |
setCurrentConsoleFont(int fontIndex)
XP Only: Sets the font index. |
void |
setCurrentConsoleFontEx(ConsoleFontInfo font,
boolean forMaximumWindowSize)
Vista Only: Sets extended information about the current console font. |
void |
setFullScreen(boolean fullScreen)
XP Only: Sets the display mode of the specified console screen buffer to fullscreen. |
void |
writeConsoleOutput(ConsoleCharInfo[] buffer,
ConsoleCoord size,
ConsoleCoord coord,
ConsoleSmallRect writeRegion)
Writes character and color attribute data to a specified rectangular block of character cells in a console screen buffer. |
void |
writeConsoleOutputAttribute(ConsoleAttribute[] attributes,
ConsoleCoord coord,
int length)
Writes a number of character attributes to consecutive cells of a console screen buffer, beginning at a specified location. |
void |
writeConsoleOutputChar(char[] chars,
ConsoleCoord coord,
int length)
Writes a number of characters to consecutive cells of a console screen buffer, beginning at a specified location. |
| Methods inherited from class com.yifanlu.Josh.JoshBuffer |
|---|
equals, getHandle, hashCode, setHandle |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ENABLE_ECHO_INPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_INSERT_MODE
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_LINE_INPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_MOUSE_INPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_PROCESSED_INPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_QUICK_EDIT_MODE
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_WINDOW_INPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_PROCESSED_OUTPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
public static final int ENABLE_WRAP_AT_EOL_OUTPUT
getConsoleMode() and setConsoleMode(int) to modify the console mode.
| Constructor Detail |
|---|
public JoshOutBuffer(ConsoleHandle handle)
handle - A memory location that this buffer represents.| Method Detail |
|---|
public ConsoleCursorInfo getConsoleCursorInfo()
public void setConsoleCursorInfo(ConsoleCursorInfo info)
info - Provides the new specifications for the console screen buffer's cursor.public void setConsoleCursorPosition(ConsoleCoord cursorPosition)
cursorPosition - The new cursor position, in characters. The coordinates are the column and row of a screen buffer character cell.
The coordinates must be within the boundaries of the console screen buffer.
public ConsoleCoord getConsoleFontSize()
throws OSNotSupportedException
OSNotSupportedException - If the current OS is not XP or higher.public int getConsoleMode()
public void setConsoleMode(int flags)
flags - Use the constants defined in this class to set the console mode, mix and match with the OR operator.public ConsoleScreenBufferInfo getConsoleScreenBufferInfo()
public void setConsoleScreenBufferInfo(ConsoleScreenBufferInfo info)
throws OSNotSupportedException
info - The console screen buffer information.
OSNotSupportedException - If the current OS is not Vista or higher.public void setConsoleTextAttribute(ConsoleAttribute attribute)
attribute - The character attributes.
public ConsoleFontInfo getCurrentConsoleFont(boolean forMaximumWindowSize)
throws OSNotSupportedException
forMaximumWindowSize - If this parameter is true, font information is retrieved for the maximum window size. If this parameter is false,
font information is retrieved for the current window size.
OSNotSupportedException - If the current OS is not XP or higher.
public void setCurrentConsoleFontEx(ConsoleFontInfo font,
boolean forMaximumWindowSize)
throws OSNotSupportedException
forMaximumWindowSize - If this parameter is true, font information is set for the maximum window size. If this parameter is false,
font information is set for the current window size.font - The font information.
OSNotSupportedException - If the current OS is not Vista or higher.
public void setCurrentConsoleFont(int fontIndex)
throws OSNotSupportedException
fontIndex - The index of the font in the system's console font table.
OSNotSupportedException - If the current OS is not XP or higher.public ConsoleCoord getLargestConsoleWindowSize()
public void scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleCoord destination)
block - The upper-left and lower-right coordinates of the console screen buffer rectangle to be moved.destination - The upper-left corner of the new location of the block contents, in characters.
public void scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleCoord destination,
ConsoleCharInfo fill)
block - The upper-left and lower-right coordinates of the console screen buffer rectangle to be moved.destination - The upper-left corner of the new location of the block contents, in characters.fill - The character and color attributes to be used in filling the cells within the intersection of block and clip that were left empty as a result of the move.
public void scrollConsoleScreenBuffer(ConsoleSmallRect block,
ConsoleSmallRect clip,
ConsoleCoord destination,
ConsoleCharInfo fill)
block - The upper-left and lower-right coordinates of the console screen buffer rectangle to be moved.clip - The upper-left and lower-right coordinates of the console screen buffer rectangle that is affected by the scrolling.destination - The upper-left corner of the new location of the block contents, in characters.fill - The character and color attributes to be used in filling the cells within the intersection of block and clip that were left empty as a result of the move.
public void setFullScreen(boolean fullScreen)
throws OSNotSupportedException
fullScreen - Sets screen buffer to full screen if true, windowed mode if false.
OSNotSupportedException - If the current OS is not XP or higher.
public void setConsoleWindowInfo(boolean absolute,
ConsoleSmallRect newSize)
absolute - If this parameter is true, the coordinates specify the new upper-left and lower-right corners of the window.
If it is false, the coordinates are relative to the current window-corner coordinates.newSize - Specifies the new upper-left and lower-right corners of the window.
public void fillConsoleOutputAttribute(ConsoleCoord coord,
int length,
ConsoleAttribute attribute)
coord - The character coordinates of the first cell whose attributes are to be set.length - The number of character cells to be set to the specified color attributes.attribute - The attributes to use when writing to the console screen buffer.
public void fillConsoleOutputCharacter(ConsoleCoord coord,
int length,
char character)
coord - The character coordinates of the first cell to which the character is to be written.length - The number of character cells to which the character should be written.character - The character to be written to the console screen buffer.
public ConsoleCharInfo[] readConsoleOutput(ConsoleCoord size,
ConsoleCoord coord,
ConsoleSmallRect readRegion)
size - The size to read, in character cells. The X member is the number of columns; the Y member is the number of rows.coord - The coordinates of the upper-left cell to start reading. The X member is the column, and the Y member is the row.readRegion - The structure members specify the upper-left and lower-right coordinates of the console screen buffer rectangle from which the function is to read.
public void writeConsoleOutput(ConsoleCharInfo[] buffer,
ConsoleCoord size,
ConsoleCoord coord,
ConsoleSmallRect writeRegion)
buffer - The data to be written to the console screen buffer.size - The size of the buffer, in character cells. The X member is the number of columns; the Y member is the number of rows.coord - The coordinates of the upper-left cell in the buffer. The X member is the column, and the Y member is the row.writeRegion - The upper-left and lower-right coordinates of the console screen buffer rectangle to write to.
public ConsoleAttribute[] readConsoleOutputAttribute(ConsoleCoord coord,
int length)
coord - The coordinates of the first cell in the console screen buffer from which to read, in characters. The X member is the column, and the Y member is the row.length - The number of screen buffer character cells from which to read.
public void writeConsoleOutputAttribute(ConsoleAttribute[] attributes,
ConsoleCoord coord,
int length)
attributes - An array that contains the character attributes.coord - The character coordinates of the first cell in the console screen buffer to which the attributes will be written.length - The number of screen buffer character cells to which the attributes will be copied.
public char[] readConsoleOutputChar(ConsoleCoord coord,
int length)
coord - The coordinates of the first cell in the console screen buffer from which to read, in characters. The X member is the column, and the Y member is the row.length - The number of screen buffer character cells from which to read.
public void writeConsoleOutputChar(char[] chars,
ConsoleCoord coord,
int length)
chars - The characters to write to the console screen buffer.coord - The character coordinates of the first cell in the console screen buffer to which characters will be written.
|
Copyright © 2010 Yifan Lu | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||