juno.io.core Module

Licence
See licence.txt for use and distribution terms.

abstract class Reader;

Represents a reade that can read a sequential series of characters.

void close();

Closes the Reader and releases any resources associated with the Reader.

char read();

Reads the next character from the input stream and advances the character position by one character.

Returns
The next character from the input stream, or char.init if no more characters are available.

int read(char[] buffer, int index, int count);

Reader a maximum of count characters from the input stream and writes the data to buffer, beginning at index.

Parameters
char[] buffer
A character array with the values between index and (index + count - 1) replaces by the characters read from the input stream.
int index
The place in buffer at which to begin writing.
int count
The maximum number of character to read.

Returns
The number of characters that have been read.

char[] readToEnd();

Reads all characters from the current position to the end of the Reader and returns them as a string.

Returns
A string containing all characters.

abstract class Writer;

Represents a writer that can write a sequential series of characters.

void close();

Closes the current writer and releases any resources associated with the writer.

void flush();

Clears all buffers for the current writer causing buffered data to be written to the underlying device.

void write(...);

Writes the text representation of the specified value or values to the stream.

void writeln(...);

Writes the text representation of the specified value or values, followed by a line terminator, to the stream.

void newLine(char[] value);
char[] newLine();

Gets or sets the line terminator used by the current writer.

abstract Encoding encoding();

Gets the encoding in which the output is written.

class StringWriter: juno.io.core.Writer;

Implements a Writer for writing information to a string.

char[] toString();

Returns a string containing the characters written to so far.

class StreamWriter: juno.io.core.Writer;

Implements a Writer for writing characters to a stream in a particular encoding.

this(Stream stream, Encoding encoding = (Encoding).UTF8);

Initializes a new instance for the specified stream, using the specified encoding.

Parameters
Stream stream
The stream to write to.
Encoding encoding
The character encoding to use.

Stream baseStream();

Gets the underlying stream.

enum ConsoleColor;

Specifies constants that define background and foreground colors for the console.

Black

The color black.

DarkBlue

The color dark blue.

DarkGreen

The color dark green.

DarkCyan

The color dark cyan.

DarkRed

The color dark red.

DarkMagenta

The color dark magenta.

DarkYellow

The color dark yellow.

Gray

The color gray.

DarkGray

The color dark gray.

Blue

The color blue.

Green

The color green.

Cyan

The color cyan.

Red

The color red.

Magenta

The color magenta.

Yellow

The color yellow.

White

The color white.

struct Console;

Represents the standard output and error streams for console applications.

static void write(...);

Writes the text representation of the specified value or values to the standard output stream.

static void writeln(...);

Writes the text representation of the specified value or values, followed by the current line terminator, to the standard output stream.

static Writer output();

Gets the standard output stream.

static void setOutput(Writer newOutput);

Sets the output property to the specified Writer object.

Parameters
Writer newOutput
The new standard output.

static void outputEncoding(Encoding value);
static Encoding outputEncoding();

Gets or sets the encoding the console uses to write output.

Parameters
Encoding value
The encoding used to write console output.

static Writer error();

Gets the standard error output stream.

static void setError(Writer newError);

Sets the error property to the specified Writer object.

Parameters
Writer newError
The new standard error output.

static void clear();

Clears the console buffer and corresponding console window of display information.

static void beep(int frequency = 800, int duration = 200);

Plays the sound of a beep of a specified frequency and duration through the console speaker.

Parameters
int frequency
The frequency of the beep, ranging from 37 to 32767 hertz.
int duration
The duration of the beep measured in milliseconds.

static void title(char[] value);
static char[] title();

Gets or sets the title to display in the console title bar.

Parameters
char[] value
The text to be displayed in the title bar of the console.

static void backgroundColor(ConsoleColor value);
static ConsoleColor backgroundColor();

Gets or sets the background color of the console.

Parameters
ConsoleColor value
The color that appears behind each character.

static void foregroundColor(ConsoleColor value);
static ConsoleColor foregroundColor();

Gets or sets the foreground color of the console.

Parameters
ConsoleColor value
The color of each character that is displayed.

static void resetColor();

Sets the foreground and background console colors to their defaults.

static void setCursorPosition(int left, int top);

Sets the position of the cursor.

Parameters
int left
The column position.
int top
The row position.

static void cursorLeft(int value);
static int cursorLeft();

Gets or sets the column position of the cursor.

static void cursorTop(int value);
static int cursorTop();

Gets or sets the row position of the cursor.

static void windowLeft(int value);
static int windowLeft();

Gets or sets the left position of the console window area relative to the screen buffer.

Parameters
int value
The left console window position measured in columns.

static void windowTop(int value);
static int windowTop();

Gets or sets the top position of the console window area relative to the screen buffer.

Parameters
int value
The top console window position measured in rows.

static void setWindowPosition(int left, int top);

Sets the position of the console window relative to the screen buffer.

Parameters
int left
The column position of the upper-left corner.
int top
The row position of the upper-left corner.

static void setWindowSize(int width, int height);

Sets the size of the console window.

Parameters
int width
The width of the console window measured in columns.
int height
The height of the console window measured in rows.

static void windowWidth(int value);
static int windowWidth();

Gets or sets the width of the console window.

Parameters
int value
The width of the console window measured in columns.

static void windowHeight(int value);
static int windowHeight();

Gets or sets the height of the console window.

Parameters
int value
The height of the console window measured in rows.