I have a large file that contains a sequence of characters such as "ABCDEabcde ..... XYZxyz". Now I want to extract some string of subsequence from it. Say, for example, from the 10th character to the 50th character string from the 15th character string to the 55th character string (all subsequence lines are the same length, i.e. 40 characters and the starting position (e.g. 10.15) always increase ) Subsequence positions are dynamic means in one run from 10 to 50 characters, from 15 to 55 characters, in another run from 2 to 42 characters and from 100 to 140 characters. Now I need to extract millions of such dynamic substrings. I tried several methods as suggested here . However, for me it is rather slow.
I tried:
1) Use the BufferedReader for a simple buffered read and wait for the desired position.
2) Use the Random Access File and Seek method for this.
As my file is about 700 mb (almost 200 million characters), and I have to extract millions of such dynamic substrings, they take almost a minute for me (the first takes more). Can someone help me by providing any other idea that could be faster than it? Using any Java library is also suitable for me.
source
share