Bug fixes + rework of BasicSupport
[gofetch.git] / src / be / nikiroo / gofetch / output / Output.java
CommitLineData
73785268
NR
1package be.nikiroo.gofetch.output;
2
73785268 3import be.nikiroo.gofetch.data.Story;
3e62b034 4import be.nikiroo.gofetch.support.Type;
73785268
NR
5
6/**
7 * Base class for output operations.
8 *
9 * @author niki
10 */
11public abstract class Output {
12 /**
13 * The type of source, can be NULL for no-type.
14 */
15 protected Type type;
16
70b18499
NR
17 /**
18 * The gopher hostname to use.
19 */
20 protected String hostname;
21
22 /**
23 * The sub directory and (pre-)selector to use for the resources.
24 */
25 protected String preselector;
26
27 /**
28 * The Gopher port to use.
29 */
30 protected int port;
31
73785268
NR
32 /**
33 * Create a new {@link Output} class for the given type (which can be NULL).
34 *
35 * @param type
36 * the type or NULL for no type
70b18499
NR
37 * @param hostname
38 * the gopher hostname to use
39 * @param preselector
40 * the sub directory and (pre-)selector to use for the resources
41 * @param port
42 * the Gopher port to use
73785268 43 */
70b18499 44 public Output(Type type, String hostname, String preselector, int port) {
73785268 45 this.type = type;
70b18499
NR
46 this.hostname = hostname;
47 this.preselector = preselector;
48 this.port = port;
73785268
NR
49 }
50
51 /**
52 * Get the header to use in the index file.
53 *
54 * @return the header
55 */
56 abstract public String getIndexHeader();
57
58 /**
59 * Get the footer to use in the index file.
60 *
61 * @return the footer
62 */
63 abstract public String getIndexFooter();
64
65 /**
5c056aad 66 * Export the header of a story (a <i>resume</i> mode).
73785268
NR
67 *
68 * @param story
69 * the story
70 *
71 * @return the resume
72 */
5c056aad 73 abstract public String exportHeader(Story story);
73785268
NR
74
75 /**
76 * Export a full story with comments.
77 *
78 * @param story
79 * the story
73785268
NR
80 *
81 * @return the story
82 */
5c056aad 83 abstract public String export(Story story);
73785268 84}