Most of the functionality
of this class would be redundant except that the
ByteToChar converters
are suddenly private API. Presumably this class will disappear
when the API is made public again. (sigh) That will also let us handle
multibyte character sets...
A subclass should override at least write(char)
and writeSpecial(int). For efficiency's sake it's a
good idea to override write(String) as well. The subclass'
initializer may also install appropriate translation and specials tables.
OutputStream
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final boolean[] | allSpecialsTable
A specials table which indicates that all characters are special |
| pack-priv static final char[] | latin1TranslationTable
A translation table which does ISO Latin-1 (trivial) |
| pack-priv static final boolean[] | noSpecialsTable
A specials table which indicates that no characters are special |
| protected boolean[] | specialsTable
A table indicating which byte values should be interpreted as characters and which should be treated as formatting codes |
| protected char[] | translationTable
A table mapping bytes to characters |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | readFromStream(InputStream
An InputStream providing text. in)A convenience method that reads text from a FileInputStream and writes it to the receiver. |
| public void | write(int b)
Implements abstract java. Implements the abstract method of OutputStream, of which this class is a subclass. |
| public void | write(byte[] buf, int off, int len)
Overrides java. Implements the buffer-at-a-time write method for greater efficiency. |
| public void | |
| protected abstract void | write(char
The character written to the OutputStream. ch)Subclasses must provide an implementation of this method which accepts a single (non-special) character. |
| protected abstract void | writeSpecial(int
The byte written to the OutputStream. b)Subclasses must provide an implementation of this method which accepts a single special byte. |
| allSpecialsTable | back to summary |
|---|---|
| pack-priv static final boolean[] allSpecialsTable A specials table which indicates that all characters are special | |
| latin1TranslationTable | back to summary |
|---|---|
| pack-priv static final char[] latin1TranslationTable A translation table which does ISO Latin-1 (trivial) | |
| noSpecialsTable | back to summary |
|---|---|
| pack-priv static final boolean[] noSpecialsTable A specials table which indicates that no characters are special | |
| specialsTable | back to summary |
|---|---|
| protected boolean[] specialsTable A table indicating which byte values should be interpreted as characters and which should be treated as formatting codes | |
| translationTable | back to summary |
|---|---|
| protected char[] translationTable A table mapping bytes to characters | |
| AbstractFilter | back to summary |
|---|---|
| public AbstractFilter() | |
| readFromReader | back to summary |
|---|---|
| public void readFromReader(Reader in) throws IOException | |
| readFromStream | back to summary |
|---|---|
| public void readFromStream(InputStream in) throws IOException A convenience method that reads text from a FileInputStream and writes it to the receiver. The format in which the file is read is determined by the concrete subclass of AbstractFilter to which this method is sent. This method does not close the receiver after reaching EOF on
the input stream.
The user must call
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Implements the abstract method of OutputStream, of which this class is a subclass.
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf, int off, int len) throws IOException Overrides java. Implements the buffer-at-a-time write method for greater efficiency. PENDING: Does
| |
| write | back to summary |
|---|---|
| public void write(String s) throws IOException Hopefully, all subclasses will override this method to accept strings
of text, but if they don't, AbstractFilter's implementation
will spoon-feed them via
| |
| write | back to summary |
|---|---|
| protected abstract void write(char ch) throws IOException Subclasses must provide an implementation of this method which accepts a single (non-special) character.
| |
| writeSpecial | back to summary |
|---|---|
| protected abstract void writeSpecial(int b) throws IOException Subclasses must provide an implementation of this method which accepts a single special byte. No translation is performed on specials.
| |