I have a Java application that makes heavy use of a large file, to read, process and give through to SolrEmbeddedServer (http://lucene.apache.org/solr/).
One of the func
Your approach with multiple replace methods could be slow.
Look at Apache Commons Lang's StringEscapeUtils for a speedy implementation of escaping HTML entities.