mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
FileTypes are used in plugins
This commit is contained in:
parent
e85d43941e
commit
836653a30b
9 changed files with 36 additions and 81 deletions
|
@ -19,13 +19,20 @@
|
|||
|
||||
package org.geometerplus.fbreader.formats;
|
||||
|
||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||
import org.geometerplus.fbreader.library.Book;
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
|
||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||
import org.geometerplus.fbreader.library.Book;
|
||||
import org.geometerplus.fbreader.filetype.*;
|
||||
|
||||
public abstract class FormatPlugin {
|
||||
public abstract boolean acceptsFile(ZLFile file);
|
||||
public final boolean acceptsFile(ZLFile file) {
|
||||
final FileType fileType = FileTypeCollection.Instance.typeById(supportedFileType());
|
||||
return fileType != null && fileType.acceptsFile(file);
|
||||
}
|
||||
|
||||
public abstract String supportedFileType();
|
||||
public abstract boolean readMetaInfo(Book book);
|
||||
public abstract boolean readLanguageAndEncoding(Book book);
|
||||
public abstract boolean readModel(BookModel model);
|
||||
|
@ -33,9 +40,11 @@ public abstract class FormatPlugin {
|
|||
public abstract String readAnnotation(ZLFile file);
|
||||
|
||||
public enum Type {
|
||||
ANY,
|
||||
JAVA,
|
||||
NATIVE,
|
||||
EXTERNAL
|
||||
EXTERNAL,
|
||||
NONE
|
||||
};
|
||||
public abstract Type type();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue