The base class for all output streams. An output stream is a means of writing data to a target in a byte-wise manner. Most output streams expect the #flush() method to be called before closing the stream, to ensure all data is actually written through. This abstract class does not provid
| 36 | * @see InputStream |
| 37 | */ |
| 38 | public abstract class OutputStream implements Closeable, Flushable { |
| 39 | |
| 40 | /** |
| 41 | * Default constructor. |
| 42 | */ |
| 43 | public OutputStream() { |
| 44 | super(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Closes this stream. Implementations of this method should free any |
| 49 | * resources used by the stream. This implementation does nothing. |
| 50 | * |
| 51 | * @throws IOException |
| 52 | * if an error occurs while closing this stream. |
| 53 | */ |
| 54 | public void close() throws IOException { |
| 55 | /* empty */ |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Flushes this stream. Implementations of this method should ensure that |
| 60 | * any buffered data is written out. This implementation does nothing. |
| 61 | * |
| 62 | * @throws IOException |
| 63 | * if an error occurs while flushing this stream. |
| 64 | */ |
| 65 | public void flush() throws IOException { |
| 66 | /* empty */ |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Writes the entire contents of the byte array {@code buffer} to this |
| 71 | * stream. |
| 72 | * |
| 73 | * @param buffer |
| 74 | * the buffer to be written. |
| 75 | * @throws IOException |
| 76 | * if an error occurs while writing to this stream. |
| 77 | */ |
| 78 | public void write(byte buffer[]) throws IOException { |
| 79 | write(buffer, 0, buffer.length); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Writes {@code count} bytes from the byte array {@code buffer} starting at |
| 84 | * position {@code offset} to this stream. |
| 85 | * |
| 86 | * @param buffer |
| 87 | * the buffer to be written. |
| 88 | * @param offset |
| 89 | * the start position in {@code buffer} from where to get bytes. |
| 90 | * @param count |
| 91 | * the number of bytes from {@code buffer} to write to this |
| 92 | * stream. |
| 93 | * @throws IOException |
| 94 | * if an error occurs while writing to this stream. |
| 95 | * @throws IndexOutOfBoundsException |
nothing calls this directly
no outgoing calls
no test coverage detected