javase--Decorative design mode

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

Io:
Java.io.OutputStream
Method:

FileOutputStream output data to disk

As an example: output data, the output is a byte

For example, output data is output multiple bytes

If it is a file copy, an input channel, an output channel, copied from the source file to the specified file up

But the copy will be very slow, there are two kinds of machine, one is solid-state drive, one is a mechanical hard disk, your SSD speed is faster, but every time you request is a byte, it will go to the hard drive to take one, read a slow, read more than a bit faster, no matter how big, in 8k way to read the line

Decorative design mode: Is the original data based on processing (processing) to form a new product, the current file stream is to go by byte byte, like a river, with the pipe to pull these water out, this is a primitive transport, transport up through a pond to purify, after the evolution of a processing area, Then in the packaging of a bottled water, that is, in the original data processing to form a new product, and then decorate and form a new product, decoration is a process

In the example: processing in the original byte to form a picture, this kind of processing is a kind of decoding

Beverage Example: Add new ingredients to the original base to form a new product

As the following picture, are seasoning, you can mix

And then you write a test class that you can match freely

Bufferedoutputstream continue caching in memory

ObjectOutputStream

Error:

javase--Decorative design mode

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.