Created
October 9, 2016 20:39
-
-
Save alebaffa/b4e9323e3b692cb6de63efa1c08fa41d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HtmlTextConverter { | |
private ReaderFactory readerFactory; | |
public HtmlTextConverter(String fullFilenameWithPath) { | |
this(new FileReaderFactory(fullFilenameWithPath)); | |
} | |
public HtmlTextConverter(ReaderFactory readerFactory) { | |
this.readerFactory = readerFactory; | |
} | |
public String convertToHtml() throws IOException { | |
Formatter htmlFormatter = getHtmlFormatter(); | |
htmlFormatter.convertToHtml(); | |
return htmlFormatter.getHtml(); | |
} | |
private Formatter getHtmlFormatter() throws IOException { | |
return new HtmlFormatter(readerFactory.createReader()); | |
} | |
public String getFilename() { | |
return readerFactory.getItemName(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment