Java Pit Note: Objectiostream and iostream of various decorative device (first dig a hole, later to fill in detail)

Source: Internet
Author: User

Java serialization and Objectstream is really a big hole.

Do not say the problem of multi-threaded environment, in a single thread, a socket can only maintain a objectoutputstream, the reason seems to be in the ObjectOutputStream lock mechanism or blocking things, otherwise it will lead to the receiver " Streamcorruptedexception:invalid Type Code AC ", the same as ObjectInputStream can only maintain one, otherwise the receiver will appear header error related exception.

It is said that the reason is that objectoutputstream at the time of construction, when the new one comes out, the output stream will be added to the beginning of a number of bytes to represent the beginning of the serialized object, multiple times new and not close will result in the flow there are multiple representations of the beginning of the place, the receiver will error.

Immediately feel Java io is really a big head, may be more than net and thread two mountain larger, and so on after the fate of the API to read the source, I will come back to fill it (flag

Java Pit Note: Objectiostream and iostream of various decorative device (first dig a hole, later to fill in detail)

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.