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 */
34 * Return the full class name of a type that implements said
37 * @return the class name
39 public String
getTypeName() {
40 String pkg
= "be.nikiroo.fanfix.reader.";
43 return pkg
+ "CliReader";
45 return pkg
+ "TuiReader";
47 return pkg
+ "GuiReader";
55 * Return the current target {@link MetaData}.
59 public MetaData
getMeta();
62 * Return the current {@link Story} as described by the current
66 * the optional progress
68 * @return the {@link Story}
70 public Story
getStory(Progress pg
);
73 * The {@link BasicLibrary} to load the stories from (by default, takes the
74 * default {@link BasicLibrary}).
76 * @return the {@link BasicLibrary}
78 public BasicLibrary
getLibrary();
81 * Change the {@link BasicLibrary} that will be managed by this
82 * {@link BasicReader}.
85 * the new {@link BasicLibrary}
87 public void setLibrary(BasicLibrary lib
);
90 * Set a {@link Story} from the current {@link BasicLibrary} into the
94 * the {@link Story} ID
97 * in case of I/O error
99 public void setMeta(String luid
) throws IOException
;
102 * Set a {@link Story} from the current {@link BasicLibrary} into the
108 * @throws IOException
109 * in case of I/O error
111 public void setMeta(MetaData meta
) throws IOException
;
114 * Set an external {@link Story} into this {@link Reader}.
117 * the {@link Story} {@link URL}
119 * the optional progress reporter
121 * @throws IOException
122 * in case of I/O error
124 public void setMeta(URL source
, Progress pg
) throws IOException
;
127 * Start the {@link Story} Reading.
129 * @throws IOException
130 * in case of I/O error or if the {@link Story} was not
133 public void read() throws IOException
;
136 * The selected chapter to start reading at (starting at 1, 0 = description,
139 * @return the chapter, or -1 for "no chapter"
141 public int getChapter();
144 * The selected chapter to start reading at (starting at 1, 0 = description,
148 * the chapter, or -1 for "no chapter"
150 public void setChapter(int chapter
);
153 * Start the reader in browse mode for the given source (or pass NULL for
157 * the type of {@link Story} to take into account, or NULL for
160 public void browse(String source
);