Hi Guys
I have 2 files (worst case - each 20 MB). Suppose file 1 : test1.txt and file 2 : test2.txt
Now, i need to read test1.txt and compare the entries in test2.txt. If text of test1.txt not found in test2.txt, i need to process else ignore.
I have been using a BufferedReader to read from the files and am building a ArrayList out of each file. My code is as below:
I am getting OutOfMemoryError. Now, i am thinking of reading test1.txt in parts, storing it in a
java Object (may b ArrayList) and than having a seperate loop wherein i read test2.txt and compare the text with the ArrayList of test1.txt(partly read file). However i want to know how can i resume reading test1.txt from the location where i had stopped reading last time
pseudo functionality :
read partly from test1.txt
store this part in a java Object
while reading test2.txt, compare the text whether it is present in the java object from above.
resume reading next part of test1.txt
-- again open test2 to read.
Guys, i know this may not be an optimized way. Kindly help.