# LibGdx: search through text file without lots of String garbage

I'm reading a text file from Gdx.files.internal in LibGdx. This is essentially streaming a file from a compressed Jar file so random access is not possible.

I want to search through the text file line by line until I get to the bit I want. That's easy enough, but I want to do it without generating loads of Strings and leaving lots for the GC to clean up.

Whats the best way of scanning through the file without creating object garbage?

It sounds like you don't want to create a whole bunch of String instances for the GC to clean up, so how about using one or more char[] to hold the text file data?