I want to extract useful data from a text file
Text file more than 200 MB
Is it possible to build a cache to put forward useful data for a paragraph, and what should I do?
---------------------------------------------------------------
Oh, 200MB just ...
In Java, you can use a memory-mapped file to manipulate large files.
Up to 2GB Max.
Here is a simple example of a more specific look at the Java API Docs or related information
Copy Code code as follows:
Import java.io.*;
Import java.nio.*;
Import java.nio.channels.*;
public class Largemappedfiles {
static int length = 0X8FFFFFF; 128 Mb
public static void Main (string[] args) throws Exception {
Mappedbytebuffer out =
New Randomaccessfile ("Test.dat", "RW"). Getchannel ()
. Map (FileChannel.MapMode.READ_WRITE, 0, length);
for (int i = 0; i < length; i++)
Out.put ((Byte) ' X ');
System.out.println ("finished writing");
for (int i = LENGTH/2 I < LENGTH/2 + 6; i++)
System.out.print ((char) out.get (i)); Read file
}
} ///