MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / open

Method open

src/org/albite/book/model/book/Book.java:570–595  ·  view source on GitHub ↗
(String filename)

Source from the content-addressed store, hash-verified

568 }
569
570 public static Book open(String filename)
571 throws IOException, BookException {
572
573 String filenameLowerCase = filename.toLowerCase();
574
575 if (filenameLowerCase.endsWith(EPUB_EXTENSION)) {
576 return new EPubBook(filename);
577 }
578
579 if (filenameLowerCase.endsWith(PLAIN_TEXT_EXTENSION)) {
580 return new FileBook(filename, null, new PlainTextParser(), false);
581 }
582
583 if (filenameLowerCase.endsWith(HTM_EXTENSION)
584 || filenameLowerCase.endsWith(HTML_EXTENSION)
585 || filenameLowerCase.endsWith(XHTML_EXTENSION)) {
586 return new FileBook(
587 filename,
588 new ArchiveFolder(
589 RandomReadingFile.getPathFromURL(filename)),
590 new HTMLTextParser(),
591 true);
592 }
593
594 throw new BookException("Unsupported file format.");
595 }
596
597 protected final void linkChapters() {
598 Chapter prev;

Callers 10

openBookMethod · 0.95
loadUserFileMethod · 0.80
FileBookMethod · 0.80
RandomReadingFileMethod · 0.80
reloadDictionariesMethod · 0.80
getEntryMethod · 0.80
showCurrDirMethod · 0.80
setDirMethod · 0.80
showCurrDirMethod · 0.80
getSelectedFileMethod · 0.80

Calls 2

getPathFromURLMethod · 0.95
toLowerCaseMethod · 0.80

Tested by

no test coverage detected