mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
synchronization with native branch
This commit is contained in:
parent
32215d6f85
commit
2032f9628b
2 changed files with 10 additions and 6 deletions
|
@ -21,6 +21,7 @@ package org.geometerplus.fbreader.filetype;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||
|
||||
public class FileTypeCollection {
|
||||
|
@ -49,4 +50,13 @@ public class FileTypeCollection {
|
|||
public FileType typeById(String id) {
|
||||
return myTypes.get(id.toLowerCase());
|
||||
}
|
||||
|
||||
public FileType typeForFile(ZLFile file) {
|
||||
for (FileType type : types()) {
|
||||
if (type.acceptsFile(file)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ 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 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue