java.lang.Object
io.ciera.runtime.api.types.Device
- Direct Known Subclasses:
ReadableDevice
A device represents a readable or read-writable object. Streams can be read
from devices or directed as output to devices.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Deviceconsole()Get a reference to the built in console device.abstract voidflush()Flush the output stream.static DevicefromString(String s) abstract <T> TRead a single token from the device stream and attempt to convert the token to typecls.abstract StringreadLine()Read a single line from the stream and return as a String.toString()abstract voidConvert an instance of an object to a String and append to the stream.abstract voidConvert an instance of an object to a String and append to the stream.
-
Constructor Details
-
Device
-
-
Method Details
-
read
Read a single token from the device stream and attempt to convert the token to typecls. The tokenization of the stream is left up to the individual implementation, however, by default tokens are delimited by whitespace.- Parameters:
cls- The type to interpret tokens as.- Returns:
- A parsed instance of the type represented by the token.
-
readLine
Read a single line from the stream and return as a String. The line terminator is determined by the system.- Returns:
- a line of text from the stream.
-
write
Convert an instance of an object to a String and append to the stream.- Parameters:
o- The instance to write.
-
writeLine
Convert an instance of an object to a String and append to the stream. Append an additional line separator. The line separator is determined by the system.- Parameters:
o-
-
flush
public abstract void flush()Flush the output stream. -
console
Get a reference to the built in console device.- Returns:
- A Device instance that represents input and output from standard input and output.
-
toString
-
fromString
-