DataOutputStream: A data output stream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in.
这个类的方法大多是writeFloat, writeDouble, writeBoolean等等, 与DataInputStream一起使用可以把java的primitive 数据写入读出.
BufferedOutputStream: The class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying
BufferedOutputStream有缓存读写的功能system for each byte written.
总结如下:
相同点:
都是用来写入数据
相同的父类结构
不同点:
BufferedOutputStream是将数据先存到缓冲区再写入,而DataOutputStream没有缓冲区功能,DataOutputStream提供java基本类型做写入操作,BufferedOutputStream没有。 |