2.1--randomaccessfile Class diagram of association class for implementing class FileChannel

Source: Internet
Author: User

The class diagram for the Datainput interface has been drawn, although the class diagram has shown elements that have various links to the two implementation classes, DataInputStream and Randomaccessfile. But at this point, I know nothing about these elements, and the class diagram is not exhaustive. The class diagram is attached and the class is interpreted.

    • External relations of the FileChannel class

The class is an abstract class that implements three interfaces simultaneously: Seekablebytechannel, Gatheringbytechannel, Scatteringbytechannel, the visible byte channel, the clustered byte channel, and the discrete byte channel. These three interfaces come from the NIO package, where the word "channel" is compared to the image, immediately reminiscent of reading and writing data. For example, these interfaces specify what parameters their implementation classes should use to implement read and write tasks. But the abstract class does not actually "implement" the operations of these interfaces, but only reuse them. This means that the abstract class should be a more generic "channel" that can handle three kinds of byte data. So its implementation of the class, the task is heavy.

The class also inherits another abstract class Abstractinterruptiblechannel (abstract interrupt channel), which does not rewrite its abstract parent class, nor does it implement its abstract method, just reusing it. The Abstractinterruptiblechannel (abstract interrupt Channel) class provides several methods: Close, IsOpen, begin, Implclosechannel, where the Implclosechannel method is an abstract method.

In this way, the FileChannel class is a more generic channel capable of reading and writing various byte data and interrupting read and write. For this class to be able to do so, you should add some class elements that enable it to automatically convert to byte data when confronted with arbitrary file, and invoke different interface operations depending on the byte data. This is just my idea, the source has its own implementation, but now I am not very concerned about it, I just want to have a general understanding of it, know what it looks like, to do what is enough.

2.1--randomaccessfile Class diagram of association class for implementing class FileChannel

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.