|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.OutputStream | +--java.io.FilterOutputStream | +--lava.io.AsciiOutputStream
ASCII output stream.
Details: AsciiOutputStream
is an OutputStream
with extensions for writing String
s in 8-bit ASCII regardless of the platform's character encoding. In the write
and writeln
methods, which write String
s, each character in the string is cast directly into a single byte
, using only the low order 8 bits, before it is written.
This class is especially useful in internationalizable code that, for some functions, must speak ASCII in order to work properly.
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
AsciiOutputStream(java.io.OutputStream out)
Sets forwarding OutputStream. |
Method Summary | |
java.lang.String |
getLineSeparator()
Returns current line separator. |
void |
setLineSeparator(java.lang.String ls)
Sets line separator. |
void |
write(java.lang.String text)
Writes ASCII string. |
void |
writeln()
Terminates line. |
void |
writeln(java.lang.String line)
Writes ASCII line. |
Methods inherited from class java.io.FilterOutputStream |
close, flush, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AsciiOutputStream(java.io.OutputStream out)
Details: This constructor binds this AsciiOutputStream
to the given OutputStream
(out). All output produced by this AsciiOutputStream
will be forwarded to out.
out
- the target output streamMethod Detail |
public void setLineSeparator(java.lang.String ls)
Details: setLineSeparator
sets the current line separator which writeln
will use. If ls
is null
, the platform's default line separator will be used.
ls
- the new line separatorpublic java.lang.String getLineSeparator()
Details: getLineSeparator
returns the line separator currently being used by the writeln
method. Note that this value will never be null
, even null
was passed to setLineSeparator
.
The writeln
s call this method once for each call, and use the result to terminate the line it is writing. Thus, some interesting line termination effects may be achieved by subclassing and overriding this method.
public void write(java.lang.String text) throws java.io.IOException
Details: write converts the given string (text) into an array of byte
s and sends them to the target OutputStream
.
This method is called by writeln
, so be careful when overriding it.
text
- the string to writejava.io.IOException
- if an I/O error occurspublic void writeln(java.lang.String line) throws java.io.IOException
Details: writeln
adds a line terminator to the given string (line) and forwards it to write(String)
.
line
- the line to writejava.io.IOException
- if an I/O error occurspublic void writeln() throws java.io.IOException
Details: writeln
forwards the current defined line terminator to write(String)
.
java.io.IOException
- if an I/O error occurs
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |