My JSON file size 126MB. it contains only one line [no spaces , so the whole file is considered as single line]. I want to split it into files each 10MB[some random amount].
WHAT I HAVE TRIED?
I tried to use filereader , streamreader etc . When i use reader.readLine() it throws me a memory error
I tried Jackson library.
File reader = new File("D:\\registry.txt"); ObjectMapper map = new ObjectMapper(); JsonParser jp = new JsonFactory().createJsonParser(reader); JsonNode masterJSON = map.readTree(jp); System.out.println(masterJSON);
It also showing the same memory error . How can i do it?
MY ALTERNATIVE WORST SOLUTION I FOUND SO FAR?
Convert the file extension to .txt . And started reading char by char until i reach maximum splitting size.Again i have to change the file extension to .json.
Any easiest way to read one line file which is large[more than 100MB] in size??