Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull-parser mode #10

Open
mkmatlock opened this issue Jul 7, 2014 · 2 comments
Open

Pull-parser mode #10

mkmatlock opened this issue Jul 7, 2014 · 2 comments

Comments

@mkmatlock
Copy link

It would be really nice for memory and processor limited applications to have a pull-parser mode, so we can do something like:

parser.init( new FileInputStream( new File("file.bib") ) );
while(parser.next()){
   BibTeXObject object = parser.get();
   ...
}

and stay within a small memory footprint, even when processing very large (5+ Mb) bibtex files.

@vruusmann
Copy link
Member

Are you thinking about using JBibTeX on smart devices? Keeping 5 MB worth of BibTeX content in memory doesn't seem like a big problem even in a situation like that.

The main problem with pull API is that there's no easy way to automate final cross-reference resolution and consistency checks (e.g. BibTeXParser#resolveCrossReferences()). Would it be acceptable to have "crossref" fields left as null then?

@mkmatlock
Copy link
Author

You could allow the user to extend and contribute a cross-reference lookup interface to the parser constructor. One possible user implementation of this interface would be to do a database lookup. I actually currently use such an interface with a factory to build models of BibTeX entries for my reference manager app when they are retrieved from an on-disk database.

Something like:

public interface IReferenceResolver {
    public BibTeXEntry resolveEntry(Key key);
    public BibTeXString resolveString(Key key);
}

My particular application is on the android platform, where my users have encountered memory limit problems. The platform can be very restrictive about memory usage, and these restrictions vary on a device by device basis. Resources for the application UI and code take up a large portion of the memory resources available, and having large bibtex databases in-memory sometime pushes it over the edge, and can also affect app performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants