One: OutputStream class:
Public abstract class OutputStream
Extends Object implements Closeable, flushable
This class is all the parent class that represents the output stream, and all subclasses that inherit the class must implement a write method. The Close,flush,write method is defined in this class.
1.FileOutputStream:
public class FileOutputStream extends OutputStream
This class is used to want to write native data to a file in byte or byet[]. When constructed, you can pass in File,filename, or filedescription. FileDescription only a single handle to a file, socket, or other data source is logged. Then one thing to note is that in the FileOutputStream constructor, you can specify whether to append data to the write. Then there is a finalize method in this class that is used to ensure that the object has been dropped when it is recycled. That is, in this method, the Close method is actually called.
2.PipedOutputStream
public class PipedOutputStream extends OutputStream
This class is primarily used to write data to the pipeline. The pipeline is used to pass data in a thread. Similarly, this class is also like a pipeline that writes native data: Byte or byte[]. Then, This class is the output of a pipeline. This class of Connect method can be used to connect to a PipedInputStream class object. But this class does not have a finalize method. PS, when the reader of a pipeline wants to read data from a pipeline that does not write data, This thread will be suspended.
3.ByteArrayOutputStream
Bytearrayoutputstream extends OutputStream
This class implements data written to a built-in buff, the buff is defined as byte[], and this class automatically expands the buff. In this class there are two proteccted fields, the buff and the count-record the buff size. Of course, The same class also writes native data, byte,byte[]. The Reset method in the class resets count to 0, which means that the data in this object is zeroed out. You can return the data of the buff by Tobytearray (), or ToString. Of course, You can specify the encoding method when using ToString. Then there is a WriteTo (OutputStream) method that can write the data in the buff directly to another outputstream. In addition, the flush of this class is useless.
Collation of JAVA IO packages