beanit / asn1bean

ASN1bean (formerly known as jASN1) is a Java ASN.1 BER and DER encoding/decoding library
https://www.beanit.com/asn1/
Apache License 2.0
110 stars 45 forks source link

How to iterate through all the records of a large CDR file #34

Closed kmrsh closed 4 years ago

kmrsh commented 4 years ago

I have generated the Java classes using the ASN schema file, and using the top level class I can successfully decode the file, however it only decode one record, and the data file is around 10-20MB in size so I'm sure it has more than one record, so my question is how do I loop through all the records in the data file using the top level java object.

ex: my code is similar to this

File inputFile = new File("c:\\path\\to\\CDR-file");
FileInputStream is = new FileInputStream(inputFile);

CallDataRecord cdr = new CallDataRecord();
cdr.decode(is);

Above code gives me the very first record CallDataRecord but how do I traverse the rest of the CallDataRecord colleciton.

Thank you

sfeuerhahn commented 4 years ago

one way to do this, is to loop over this until you get an EOFException which means the end of the stream has been reached.