It's not a secret anymore!*
The moose likes I/O and Streams and the fly likes Tool for reading big text files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Tool for reading big text files" Watch "Tool for reading big text files" New topic
Author

Tool for reading big text files

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
Hi All,

I have a problem where my java code has to read big log files(around 4GB) containing XML and parser those XML to populate data. I can easily parse data using JAXB but i need to know if there is any open source tool provided to read those log files? I have to read these log files to identify a XML request chunk and process it continually till end of file.

I can have java code to read using buffered reader but performance will be an issue then for the reading a 4GB file along with processing data chunk. Can someone please suggest a tool of any design pattern/architectural ideas?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
The SAX API should be able to handle XML files of just about any size, and is likely to be faster than using JAXB or other high-level APIs.


Ping & DNS - my free Android networking tools app
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
Will SAX be able to read and parser XML from a text log file of 4 GB?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Thart's what i said, and it is, of course, easy enough to test.
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
Thanks Mr. Dittmer, i will try it.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

SAX and StAX don't store the entire file in memory, only the separate elements and their text. After it's been processed, SAX / StAX discards it (your code may still keep a reference though). Unless your XML file has elements with millions of attributes, or has enormous pieces of text, SAX and StAX should be able to handle the file just perfectly.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tool for reading big text files
 
Similar Threads
JAVA API to Read XML File?
MSAA and Java Accessibility API
Specific Attachment Problem...
ultimate data load tool - ideas
Problem in OutputStream