How Java handles large files

Source: Internet
Author: User

1: we often use reading to the file stream and then performing operations in the stream. This is no problem for small files. For large files, because the file object needs to be converted into a stream, as long as the stream is used for large file operations, it will certainly overflow. Here we will introduce two methods, in fact, almost all

2: Memory ing in NIO. the maximum number of int values can be mapped at a time, which is 2 GB in 32 bits. Therefore, perform operations on these 2G resources. For details about the ing, refer to relevant materials and use randomaccessfile.
3: Use the randomaccessfile class, set the buffer, and read the buffer size bytes at a time.

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.