Skip to content

Instantly share code, notes, and snippets.

@alebaffa
Last active October 9, 2016 19:27
Show Gist options
  • Save alebaffa/f1f7e91dba6c6252d1237381da856645 to your computer and use it in GitHub Desktop.
Save alebaffa/f1f7e91dba6c6252d1237381da856645 to your computer and use it in GitHub Desktop.
public class HtmlTextConverter
{
private String fullFilenameWithPath;
public HtmlTextConverter(String fullFilenameWithPath) { this.fullFilenameWithPath = fullFilenameWithPath; }
public String convertToHtml() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(fullFilenameWithPath));
String line = reader.readLine();
String html = "";
while (line != null)
{
html += StringEscapeUtils.escapeHtml(line);
html += "<br />";
line = reader.readLine();
}
return html;
}
public String getFilename() { return this.fullFilenameWithPath; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment