use of org.geometerplus.fbreader.formats.BookReadingException in project FBReaderJ by geometer.
the class OEBNativePlugin method getOpfFile.
private ZLFile getOpfFile(ZLFile oebFile) throws BookReadingException {
if ("opf".equals(oebFile.getExtension())) {
return oebFile;
}
final ZLFile containerInfoFile = ZLFile.createFile(oebFile, "META-INF/container.xml");
if (containerInfoFile.exists()) {
final ContainerFileReader reader = new ContainerFileReader();
reader.readQuietly(containerInfoFile);
final String opfPath = reader.getRootPath();
if (opfPath != null) {
return ZLFile.createFile(oebFile, opfPath);
}
}
for (ZLFile child : oebFile.children()) {
if (child.getExtension().equals("opf")) {
return child;
}
}
throw new BookReadingException("opfFileNotFound", oebFile);
}
Aggregations