|
DthingApi
|
Public Member Functions | |
| abstract void | close () throws IOException |
| abstract void | flush () throws IOException |
| void | write (char[] buf) throws IOException |
| abstract void | write (char[] buf, int offset, int count) throws IOException |
| void | write (int oneChar) throws IOException |
| void | write (String str) throws IOException |
| void | write (String str, int offset, int count) throws IOException |
Protected Member Functions | |
| Writer () | |
| Writer (Object lock) | |
Protected Attributes | |
| Object | lock |
The base class for all writers. A writer is a means of writing data to a target in a character-wise manner. Most output streams expect the flush() method to be called before closing the stream, to ensure all data is actually written out.
This abstract class does not provide a fully working implementation, so it needs to be subclassed, and at least the write(char[], int, int), close() and flush() methods needs to be overridden. Overriding some of the non-abstract methods is also often advised, since it might result in higher efficiency.
Many specialized readers for purposes like reading from a file already exist in this package.
|
inlineprotected |
|
inlineprotected |
|
abstract |
Closes this writer. Implementations of this method should free any resources associated with the writer.
| IOException | if an error occurs while closing this writer. |
|
abstract |
Flushes this writer. Implementations of this method should ensure that all buffered characters are written to the target.
| IOException | if an error occurs while flushing this writer. |
|
inline |
Writes the entire character buffer
to the target.
| buf | the non-null array containing characters to write. |
| IOException | if this writer is closed or another I/O error occurs. |
|
abstract |
Writes
characters starting at
in
to the target.
| buf | the non-null character array to write. |
| offset | the index of the first character in buf |
| count | the maximum number of characters to write. |
| IndexOutOfBoundsException | if offset < 0 count < 0 offset + count buf |
| IOException | if this writer is closed or another I/O error occurs. |
|
inline |
Writes one character to the target. Only the two least significant bytes of the integer
are written.
| oneChar | the character to write to the target. |
| IOException | if this writer is closed or another I/O error occurs. |
|
inline |
Writes the characters from the specified string to the target.
| str | the non-null string containing the characters to write. |
| IOException | if this writer is closed or another I/O error occurs. |
|
inline |
Writes
characters from
starting at
to the target.
| str | the non-null string containing the characters to write. |
| offset | the index of the first character in str |
| count | the number of characters from str |
| IOException | if this writer is closed or another I/O error occurs. |
| IndexOutOfBoundsException | if offset < 0 count < 0 offset + count str |
|
protected |
The object used to synchronize access to the writer.
1.8.13