1 package be
.nikiroo
.fanfix
.reader
;
3 import java
.io
.IOException
;
6 import be
.nikiroo
.fanfix
.data
.Story
;
7 import be
.nikiroo
.fanfix
.library
.BasicLibrary
;
8 import be
.nikiroo
.fanfix
.library
.LocalLibrary
;
9 import be
.nikiroo
.utils
.Progress
;
11 public interface Reader
{
13 * A type of {@link BasicReader}.
17 public enum ReaderType
{
18 /** Simple reader that outputs everything on the console */
20 /** Reader that starts local programs to handle the stories */
22 /** A text (UTF-8) reader with menu and text windows */
28 * Return the full class name of a type that implements said
31 * @return the class name
33 public String
getTypeName() {
34 String pkg
= "be.nikiroo.fanfix.reader.";
37 return pkg
+ "CliReader";
39 return pkg
+ "TuiReader";
41 return pkg
+ "GuiReader";
49 * Return the current {@link Story}.
51 * @return the {@link Story}
53 public Story
getStory();
56 * The {@link LocalLibrary} to load the stories from (by default, takes the
57 * default {@link LocalLibrary}).
59 * @return the {@link LocalLibrary}
61 public BasicLibrary
getLibrary();
64 * Change the {@link LocalLibrary} that will be managed by this
65 * {@link BasicReader}.
68 * the new {@link LocalLibrary}
70 public void setLibrary(LocalLibrary lib
);
73 * Set a {@link Story} from the current {@link Library} into the
77 * the {@link Story} ID
79 * the optional progress reporter
82 * in case of I/O error
84 public void setStory(String luid
, Progress pg
) throws IOException
;
87 * Set an external {@link Story} into this {@link Reader}.
90 * the {@link Story} {@link URL}
92 * the optional progress reporter
95 * in case of I/O error
97 public void setStory(URL source
, Progress pg
) throws IOException
;
100 * Start the {@link Story} Reading.
102 * @throws IOException
103 * in case of I/O error or if the {@link Story} was not
106 public void read() throws IOException
;
109 * Read the selected chapter (starting at 1, 0 = description, -1 = none).
112 * the chapter, or -1 for "no chapter"
114 * @throws IOException
115 * in case of I/O error or if the {@link Story} was not
118 public void read(int chapter
) throws IOException
;
121 * Start the reader in browse mode for the given source (or pass NULL for
125 * the type of {@link Story} to take into account, or NULL for
128 public void browse(String source
);