A writable sink for bytes.
Most clients will use output streams that write data to the file system (FileOutputStream), the network (getOutputStream()/getOutputStream()), or to an in-memory byte array (ByteArrayOutputStream).
Use OutputStreamWriter to adapt a byte stream like this one into a character stream.
Most clients should wrap their output stream with BufferedOutputStream. Callers that do only bulk writes may omit buffering.
Subclassing OutputStream
Subclasses that decorate another output stream should consider subclassing FilterOutputStream, which delegates all calls to the target output stream.
All output stream subclasses should override both write(int) and write(byte[],int,int). The three argument overload is necessary for bulk access to the data. This is much more efficient than byte-by-byte access.