In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "the relationship between Java NIO class libraries". In daily operation, I believe many people have doubts about the relationship between Java NIO class libraries. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "the relationship between Java NIO class libraries". Next, please follow the editor to study!
The following diagram shows the relationships between the classes of the nio class library so that you know how to move and transform data. For example, if you want to write the byte array to a file, you have to wrap the byte array to buffer with the ByteBuffer.wrap () method, and then open a channel on the FileOutputStream with getChannel () before you can write the data to FileChannel with ByteBuffer.
Note that ByteBuffer is a way to read and write data to channel, and you can only create a buffer ByteBuffer of this basic type of byte, and the rest of the basic types of buffers should be obtained using the "as" method. In addition, you can't convert the basic type buffer to ByteBuffer, but you can use view buffer to read and write basic type data to ByteBuffer, so this is actually not a restriction.
In addition, view is a logical concept, and operation through view is essentially an operation on ByteBuffer, just like operating List through Iterator. Although we can convert the char array to CharBuffer directly with wrap (), it is actually a ByteBuffer, and CharBuffer is just its view. From this, we can see that the object we control is always ByteBuffer, because only it can read and write data to channel, and other basic types of data buffers work the same way.
At this point, the study of "the relationship between Java NIO class libraries" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.