|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.io.ASALineWriter
public class ASALineWriter
ASA line printer output stream. These methods interpret ASA (ANS) printer form control characters in the first column of each output line.
ASA (ANS) printer form control characters perform some action affecting the position of the logical printing mechanism prior to printing the remaining contents of line. The control characters are:
Char | Action | ASCII Equivalent |
---|---|---|
1 | Advance the page (form feed) | FF |
space | Advance one line | CR LF|
0 | Advance two lines | CR LF CR LF|
- | Advance three lines | CR LF CR LF CR LF|
+ | Do not advance any lines, overprint the previous line |
CR |
In place of CR LF sequences to advance to the next line, the native newline character sequence is used (which could be CR, CR LF, or LF sequences).
The output methods are synchronized, so that when multiple threads write text lines to the same line printer stream, each line is written atomically. The resulting output will contain interspersed output lines, with no split or incomplete lines.
Source code
david.tribble.com/src/java/tribble/io/ASALineWriter.java
david.tribble.com/src/java.
Copyright ©2007 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated
by the United States Department of State as a terrorist, or terrorist
government or agency, to use and distribute this source code provided
that the original copyright notice remains present and unaltered.
Field Summary | |
---|---|
(package private) static java.lang.String |
REV
Revision information. |
Constructor Summary | |
---|---|
ASALineWriter(java.io.Writer out)
Constructor. |
|
ASALineWriter(java.io.Writer out,
java.lang.Object lock)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close the output stream. |
protected void |
finalize()
Finalization. |
void |
flush()
Write any pending output to the output stream. |
int |
getLineCount()
Retrieve the number of lines written to the output stream. |
int |
getPageCount()
Retrieve the number of pages written to the output stream. |
static void |
main(java.lang.String[] args)
Convert an ASA printer file into ASCII. |
void |
setLineCount(int n)
Reset the line counter for the output stream. |
void |
setPageCount(int n)
Reset the page counter for the output stream. |
void |
writeLine()
Write an empty line to the output stream. |
int |
writeLine(char[] buf)
Write a line of characters to the output stream. |
int |
writeLine(char[] buf,
int off,
int len)
Write a line of characters to the output stream. |
void |
writeLine(java.lang.String line)
Write a line of characters to the output stream. |
void |
writeLine(java.lang.String line,
int off,
int len)
Write a line of characters to the output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String REV
Constructor Detail |
---|
public ASALineWriter(java.io.Writer out)
out
- Underlying output stream.
All I/O operations will synchronize on this object.
java.lang.NullPointerException
- (unchecked)
Thrown if out is null.public ASALineWriter(java.io.Writer out, java.lang.Object lock)
out
- Underlying output stream.lock
- All I/O operations will synchronize on this object.
This can be null, in which case all I/O operations synchronize on the line
printer object itself.
java.lang.NullPointerException
- (unchecked)
Thrown if out is null.Method Detail |
---|
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void close() throws java.io.IOException
java.io.IOException
- Thrown if an I/O write error occurs.public void flush() throws java.io.IOException
java.io.IOException
- Thrown if an I/O write error occurs.public void writeLine(java.lang.String line) throws java.io.IOException
line
- Text line to write.
Note that other than the first character, the contents of this line are
not interpreted. This implies that non-printing characters (especially
'\n', '\r', and '\f' characters) will produce
unexpected results.
java.io.IOException
- Thrown if an I/O write error occurs.public void writeLine(java.lang.String line, int off, int len) throws java.io.IOException
line
- Text line to write.
Note that other than the first character, the contents of this line are
not interpreted. This implies that non-printing characters (especially
'\n', '\r', and '\f' characters) will produce
unexpected results.off
- Index of the first character in line to write.len
- Number of characters in line to write.
java.io.IOException
- Thrown if an I/O write error occurs.public void writeLine() throws java.io.IOException
java.io.IOException
- Thrown if an I/O write error occurs.public int writeLine(char[] buf) throws java.io.IOException
buf
- Characters to write.
Note that other than the first character, the contents of this line are
not interpreted. This implies that non-printing characters (especially
'\n', '\r', and '\f' characters) will produce
unexpected results.
java.io.IOException
- Thrown if an I/O write error occurs.public int writeLine(char[] buf, int off, int len) throws java.io.IOException
buf
- Characters to write.
Note that other than the first character, the contents of this line are
not interpreted. This implies that non-printing characters (especially
'\n', '\r', and '\f' characters) will produce
unexpected results.off
- Index of the first character in buf to write.len
- Number of characters in buf to write.
java.io.IOException
- Thrown if an I/O write error occurs.public int getLineCount()
public void setLineCount(int n)
n
- Line number at which to begin re-counting.public int getPageCount()
public void setPageCount(int n)
n
- Page number at which to begin re-counting.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |