OutputStream
In this chapter you will learn:
Use OutputStream
Byte streams are defined by using two class hierarchies.
At the top are two abstract classes: InputStream
and OutputStream
.
OutputStream
class is the superclass of all classes representing an output stream of bytes.
An output stream accepts output bytes and sends them to some sink.
Applications that need to define a subclass of OutputStream
must always provide at least a
method that writes one byte of output.
The following table lists the output streams.
Stream Class | Meaning |
---|---|
OutputStream | Abstract class that describes stream output |
BufferedOutputStream | Buffered output stream |
ByteArrayOutputStream | Output stream that writes to a byte array |
DataOutputStream | An output stream that contains methods for writing the Java standard data types |
FileOutputStream | Output stream that writes to a file |
FilterOutputStream | Implements OutputStream |
ObjectOutputStream | Output stream for objects |
PipedOutputStream | Output pipe |
Next chapter...
What you will learn in the next chapter:
- How to use FileOutputStream
- Create FileOutputStream object from File object
- Append output to file using FileOutputStream
- How to copy a file with FileInputStream and FileOutputStream
- Write byte array to a file using FileOutputStream
Home » Java Tutorial » Reader Writer