|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.io.Console
public class Console
Implements Console communication for JControl.
Field Summary | |
---|---|
static ConsoleInputStream |
in
|
static ConsoleOutputStream |
out
|
Fields inherited from interface jcontrol.comm.ConsoleOutputStream |
---|
STD_LF |
Fields inherited from interface jcontrol.comm.ConsoleInputStream |
---|
LF_CHARS |
Constructor Summary | |
---|---|
Console()
Constructs a default console object. |
Method Summary | |
---|---|
int |
available()
Get the count of bytes that available and can be read once. |
void |
close()
Console Outputstreams can't be closed! |
void |
flush()
flush buffered bytes |
void |
mark(int readlimit)
NOTE: not supported |
boolean |
markSupported()
NOTE: not supported |
void |
print(String text)
Writes a String to the console. |
void |
println()
Writes a linefeed to the console. |
void |
println(String text)
Writes a String and a linefeed to the console. |
int |
read()
Read exactly 1 byte from the console. |
int |
read(byte[] b)
Reads a number of bytes from the console into the overgiven bytearray. |
int |
read(byte[] b,
int off,
int len)
Reads a number of bytes from the console into the overgiven bytearray beginning by offset off and maximum length of len . |
String |
readLine()
NOTE: not supported Reads a single String from the console. |
void |
reset()
NOTE: not supported |
int |
skip(int n)
NOTE: not supported |
void |
write(byte[] b)
Writes a Byte-Array to the console. |
void |
write(byte[] b,
int off,
int len)
Writes a Byte-Array beginning by off with length len
to the console. |
void |
write(int b)
Writes a Byte to to console. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public static ConsoleOutputStream out
public static ConsoleInputStream in
Constructor Detail |
---|
public Console()
Method Detail |
---|
public void print(String text)
String
to the console.
Unicode characters will not be decoded.
print
in interface ConsoleOutputStream
text
- String
to writeString
public void println(String text)
String
and a linefeed to the console.
Unicode characters will not be decoded.
println
in interface ConsoleOutputStream
text
- String
to writeString
public void println()
println
in interface ConsoleOutputStream
public void write(int b) throws IOException
Byte
to to console.
write
in interface BasicOutputStream
b
- byte to write
IOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void write(byte[] b) throws IOException
Byte-Array
to the console.
write
in interface BasicOutputStream
b
- bytes to write
IOException
- if an I/O error occurs.OutputStream.write(byte[], int, int)
public void write(byte[] b, int off, int len) throws IOException
Byte-Array
beginning by off
with length len
to the console.
write
in interface BasicOutputStream
b
- bytes to writeoff
- start byte offsetlen
- length of bytes to write
IOException
- if an I/O error occurs. In particular,
an IOException
is thrown if the output
stream is closed.public String readLine() throws IOException
String
from the console.
The String is received character-by-character until an linefeed character defined
in ConsoleInputStream
is received. There is a buffer if size
BUFFERSIZE
allocated to store the received bytes, if the buffer
is full a linefeed is forced.
readLine
in interface ConsoleInputStream
String
read
IOException
- if an error occursString
public int read() throws IOException
read
in interface BasicInputStream
IOException
- if an I/O error occurs.public int read(byte[] b) throws IOException
Note: this method does the same like read(b, 0, b.length)
read
in interface BasicInputStream
b
- bytearray to store read bytes
IOException
- if an I/O error occurs.InputStream.read(byte[], int, int)
public int read(byte[] b, int off, int len) throws IOException
off
and maximum length of len
. The number
of read bytes is returned. If no bytes available, this method doesn't touch the
overgiven bytearray and return 0.
read
in interface BasicInputStream
b
- bytearray to store read bytesoff
- start offsetlen
- max length of bytes to read
IOException
- if an I/O error occurs.InputStream.read()
public void flush() throws IOException
flush
in interface BasicOutputStream
IOException
- if an I/O error occurs.public int available() throws IOException
available
in interface BasicInputStream
IOException
- if an I/O error occurs.public void close() throws IOException
close
in interface BasicInputStream
close
in interface BasicOutputStream
IOException
- if an I/O error occurs.public void mark(int readlimit)
mark
in interface BasicInputStream
readlimit
- the maximum limit of bytes that can be read before
the mark position becomes invalid.public boolean markSupported()
markSupported
in interface BasicInputStream
public void reset() throws IOException
reset
in interface BasicInputStream
IOException
- if this stream has not been makred or if the
mark has been invalidated.public int skip(int n) throws IOException
skip
in interface BasicInputStream
n
- the number of bytes to be skipped.
IOException
- if an I/O error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |