1 package be
.nikiroo
.fanfix
.reader
;
3 import java
.io
.IOException
;
6 import be
.nikiroo
.fanfix
.data
.MetaData
;
7 import be
.nikiroo
.fanfix
.data
.Story
;
8 import be
.nikiroo
.fanfix
.library
.BasicLibrary
;
9 import be
.nikiroo
.utils
.Progress
;
12 * A {@link Reader} is a class that will handle {@link Story} reading and
17 public interface Reader
{
19 * A type of {@link BasicReader}.
23 public enum ReaderType
{
24 /** Simple reader that outputs everything on the console */
26 /** Reader that starts local programs to handle the stories */
28 /** A text (UTF-8) reader with menu and text windows */
30 /** A GUI reader implemented with the Android framework */
36 * Return the full class name of a type that implements said
39 * @return the class name
41 public String
getTypeName() {
42 String pkg
= "be.nikiroo.fanfix.reader.";
45 return pkg
+ "cli.CliReader";
47 return pkg
+ "tui.TuiReader";
49 return pkg
+ "ui.GuiReader";
51 return pkg
+ "android.AndroidReader";
59 * Return the current target {@link MetaData}.
63 public MetaData
getMeta();
66 * Return the current {@link Story} as described by the current
70 * the optional progress
72 * @return the {@link Story}
74 public Story
getStory(Progress pg
);
77 * The {@link BasicLibrary} to load the stories from (by default, takes the
78 * default {@link BasicLibrary}).
80 * @return the {@link BasicLibrary}
82 public BasicLibrary
getLibrary();
85 * Change the {@link BasicLibrary} that will be managed by this
86 * {@link BasicReader}.
89 * the new {@link BasicLibrary}
91 public void setLibrary(BasicLibrary lib
);
94 * Set a {@link Story} from the current {@link BasicLibrary} into the
98 * the {@link Story} ID
100 * @throws IOException
101 * in case of I/O error
103 public void setMeta(String luid
) throws IOException
;
106 * Set a {@link Story} from the current {@link BasicLibrary} into the
112 * @throws IOException
113 * in case of I/O error
115 public void setMeta(MetaData meta
) throws IOException
;
118 * Set an external {@link Story} into this {@link Reader}.
121 * the {@link Story} {@link URL}
123 * the optional progress reporter
125 * @throws IOException
126 * in case of I/O error
128 public void setMeta(URL source
, Progress pg
) throws IOException
;
131 * Start the {@link Story} Reading.
134 * execute the process synchronously (wait until it is terminated
137 * @throws IOException
138 * in case of I/O error or if the {@link Story} was not
141 public void read(boolean sync
) throws IOException
;
144 * The selected chapter to start reading at (starting at 1, 0 = description,
147 * @return the chapter, or -1 for "no chapter"
149 public int getChapter();
152 * The selected chapter to start reading at (starting at 1, 0 = description,
156 * the chapter, or -1 for "no chapter"
158 public void setChapter(int chapter
);
161 * Start the reader in browse mode for the given source (or pass NULL for
164 * Note that this must be a <b>synchronous</b> action.
167 * the type of {@link Story} to take into account, or NULL for
170 public void browse(String source
);
173 * Open the {@link Story} with an external reader (the program should be
174 * passed the main file associated with this {@link Story}).
177 * the {@link BasicLibrary} to select the {@link Story} from
179 * the {@link Story} LUID
181 * execute the process synchronously (wait until it is terminated
184 * @throws IOException
185 * in case of I/O error
187 public void openExternal(BasicLibrary lib
, String luid
, boolean sync
)