The OutputStream class provides different methods that are implemented by its subclasses. Here are some of the methods
- write() - writes the specified byte to the output stream.
- write(byte[] array) - writes the bytes from the specified array to the output stream.
- flush() - forces to write all data present in output stream to the destination.
- close() - closes the output stream.
Here is how we can implement OutputStream using the FileOutputStream class.