[antlr-interest] performance issue with skip functionality in generated Java parser for binary data

Mark Venbrux mark.venbrux at gmail.com
Wed Sep 7 05:34:31 PDT 2005


Hi,
First of all: ANTLR is great. Especially with the Eclipse plug-in.
So I tried something difficult to start with. Namely: parsing binary IsoBox 
files. 
This is a file structure with no explicit separators, so you need to 
interpret length fields to parse the structure.
The media content is just a lot of data, so I would like to skip it. But 
performance for big files collapses completely.
 I use the following function to skip data:
 
* private void skipData(int length)
{
InputBuffer buf = getInputBuffer(); 
try {
buf.fill(length);
for (int i = 0; i < length; i++) {
buf.consume();
}
setColumn(getColumn()+length);
} catch (CharStreamException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} 
}
*

*Isthere a more optimal way to skip data that one is not interested in?
* 

 -- 
Mvg,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050907/e553d1cc/attachment.html


More information about the antlr-interest mailing list