ObjectOutputStream in Java can be used to convert an object to OutputStream. The process of converting object to stream is called serialization in java.
Java中的ObjectOutputStream可用于将对象转换为OutputStream。 将对象转换为流的过程在java中称为序列化 。
Once an object is converted to Output Stream, it can be saved to file or database, send over the network or used in socket connections. So we can use FileOutputStream to write Object to file.
将对象转换为输出流后,可以将其保存到文件或数据库中,通过网络发送或用于套接字连接。 因此,我们可以使用FileOutputStream将Object写入文件。
ObjectOutputStream (ObjectOutputStream)
ObjectOutputStream is part of Java IO classes and its whole purpose is to provide us a way to convert java object to a stream. When we create an instance of ObjectOutputStream, we have to provide the OutputStream to be used. This OutputStream is further used by ObjectOutputStream to channel the object stream to underlying output stream, for example, FileOutputStream.
ObjectOutputStream是Java IO类的一部分,其整个目的是为我们提供一种将Java对象转换为流的方法。 创建ObjectOutputStream的实例时,必须提供要使用的OutputStream。 ObjectOutputStream进一步使用此OutputS