What is the difference between a DataOutputStream class and a Bufferedoutputstream class?

Source: Internet
Author: User
DataOutputStream class and Buffere What is the difference between the Doutputstream class?

DataOutputStream dataout=new DataOutputStream (new

FileOutputStream ("file"));
Bufferedoutputstream dataout1=new Bufferedoutputstream (new

FileOutputStream ("file"));

What is the difference between the DataOutputStream class and the Bufferedoutputstream class:
The Bufferedoutputstream class can create a buffer in memory that, when writing a file, can play a

Buffering effect. But DataOutputStream can act as a buffer like the Bufferedoutputstream class.

Use it? If there is a buffer, but the DataOutputStream class constructor, there is only one.

and the parameters of its constructor do not provide a parameter to set the cache size?
Cooljia 2006-4-1 06:51
--> in common is that two classes are java.io.FilterOutputStream subclasses, but the two classes are different:

[U] [b] DATAOUTPUTSTREAM[/B][/U]

A data output stream lets an application write primitive Java data types to a output stream in a portable way. An application can then with a data input stream to read the data.

So most of the methods of this class are Writefloat, Writedouble, Writeboolean, and so on, which can be written to read from Java primitive data with DataInputStream.

[U] [b] BUFFEREDOUTPUTSTREAM[/B][/U]
The class implements a buffered output stream. By setting up such a output stream, an application can write bytes to the underlying output stream without necessarily CA Using a call to the underlying system for each byte written.

Bufferedoutputstream has cached read-write functionality, while DataOutputStream does not

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.