Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java load and process big data

I have several big data(1G each) files containing person's information(just name and phone numbers). The format is clear and flexible. The problem is load and process them. Process one of them maybe still feasible but if I want to process them all under certain directory, things get tricky. When I use

 File file = chooser.getSelectFile();

and get a directory, I think the next step is put the file in the file array:

 File[] files = file.ListFile();  

But will that cause a problem? Since each file is 1G, the VM's memory wont ablt to hold all these files together. In order to search them later, I think I may want to sort them first. How can I sort these individual files? Since the total size is so big, the idea: put them into files like A.txt, B.txt which start with letter A and B is not sufficient.

like image 730
user3427439 Avatar asked Apr 16 '26 02:04

user3427439


1 Answers

A File just represents the file name, not the contents. Unless you have many thousands of files per directory, you haven't done anything to use much memory yet.

Don't try to process these files by loading each one entirely into memory though.

like image 96
user207421 Avatar answered Apr 18 '26 14:04

user207421



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!