|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.output.AbstractDuDeOutput
public abstract class AbstractDuDeOutput
AbstractDuDeOuput
is an abstract
class which provides the common functionality of every class that implements
DuDeOutput
. Every concrete DuDeOutput
implementation might inherit from this class instead of implementing the
DuDeOutput
interface directly.
Field Summary | |
---|---|
protected OutputStreamWriter |
outputStream
The stream writer that is used for the output. |
Constructor Summary | |
---|---|
protected |
AbstractDuDeOutput()
Internal constructor for Jsonable deserialization. |
|
AbstractDuDeOutput(File out)
Initializes a DuDeOutput with the given File . |
|
AbstractDuDeOutput(File out,
String hdr)
Initializes a DuDeOutput with the given File . |
|
AbstractDuDeOutput(File out,
String hdr,
String ftr)
Initializes a DuDeOutput with the given File . |
|
AbstractDuDeOutput(OutputStream out)
Initializes a DuDeOutput with the given OutputStream . |
|
AbstractDuDeOutput(OutputStream out,
String hdr)
Initializes a DuDeOutput with the given OutputStream . |
|
AbstractDuDeOutput(OutputStream out,
String hdr,
String ftr)
Initializes a DuDeOutput with the given OutputStream . |
Method Summary | |
---|---|
void |
close()
Closes the stream. |
void |
fromJson(DuDeJsonParser<?> jsonParser)
Initializes the current instance using the passed DuDeJsonParser . |
protected String |
getDefaultFooter()
Returns the default footer of the implementation. |
protected String |
getDefaultHeader()
Returns the default header of the implementation. |
protected boolean |
printDataEnabled()
Checks whether printing the data is enable or not. |
void |
toJson(DuDeJsonGenerator jsonGenerator)
Generates the Json code using the passed DuDeJsonGenerator . |
AbstractDuDeOutput |
withData()
Enables printing the data. |
AbstractDuDeOutput |
withoutData()
Disables printing the data. |
abstract void |
write(DuDeObjectPair pair)
Writes the DuDeObjectPair onto an stream. |
void |
writeDuplicatesOnly(DuDeObjectPair pair)
DuDeOutput#writeDuplicatesOnly(DuDeObjectPair) |
protected void |
writelnToStream(String str)
Writes the passed string followed by a newline into the OutputStream . |
protected void |
writeToStream(String str)
Writes the passed string into the OutputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient OutputStreamWriter outputStream
Constructor Detail |
---|
public AbstractDuDeOutput(OutputStream out) throws IOException
DuDeOutput
with the given OutputStream
. Since no specialized header and footer are set the default Strings
will be printed. The data is not printed besides the source and object ids.
out
- The OutputStream
into which the information is written.
IOException
- If an error occurs while printing the header.public AbstractDuDeOutput(OutputStream out, String hdr) throws IOException
DuDeOutput
with the given OutputStream
. Since no specialized footer is set the default String will be
printed. The data is not printed besides the source and object ids.
out
- The OutputStream
into which the information is written.hdr
- Specifies the header that is written in front of the result list.
IOException
- If an error occurs while printing the header.public AbstractDuDeOutput(OutputStream out, String hdr, String ftr) throws IOException
DuDeOutput
with the given OutputStream
. The passed Strings will be used as header and footer.
out
- The OutputStream
into which the information is written.hdr
- Specifies the header that is written in front of the result list.ftr
- Specifies the footer that is written after the result list was printed.
IOException
- If an error occurs while printing the header.public AbstractDuDeOutput(File out) throws IOException
DuDeOutput
with the given File
. Since no specialized header and footer are set the default Strings will be
printed. The data is not printed besides the source and object ids.
out
- The File
into which the information is written.
IOException
- If an error occurs while printing the header.public AbstractDuDeOutput(File out, String hdr) throws IOException
DuDeOutput
with the given File
. Since no specialized footer is set the default String will be printed. The
data is not printed besides the source and object ids.
out
- The File
into which the information is written.hdr
- Specifies the header that is written in front of the result list.
IOException
- If an error occurs while printing the header.public AbstractDuDeOutput(File out, String hdr, String ftr) throws IOException
DuDeOutput
with the given File
. The passed Strings will be used as header and footer.
out
- The File
into which the information is written.hdr
- Specifies the header that is written in front of the result list.ftr
- Specifies the footer that is written after the result list was printed.
IOException
- If an error occurs while printing the header.protected AbstractDuDeOutput()
Jsonable
deserialization.
Method Detail |
---|
protected boolean printDataEnabled()
true
, if printing the data is enabled; otherwise false
.public AbstractDuDeOutput withData()
DuDeOutput
withData
in interface DuDeOutput
public AbstractDuDeOutput withoutData()
DuDeOutput
withoutData
in interface DuDeOutput
protected void writeToStream(String str) throws IOException
OutputStream
.
str
- The string that will be written into the OutputStream
.
IOException
- If an error occurs while writing to the OutputStream
.protected void writelnToStream(String str) throws IOException
OutputStream
.
str
- The string that will be written into the OutputStream
.
IOException
- If an error occurs while writing to the OutputStream
.public void close() throws IOException
DuDeOutput
close
in interface DuDeOutput
IOException
- If an error occurs while closing the stream.protected String getDefaultHeader()
protected String getDefaultFooter()
public abstract void write(DuDeObjectPair pair) throws IOException
DuDeOutput
DuDeObjectPair
onto an stream.
write
in interface DuDeOutput
pair
- A pair of two DuDeObject
s that are written into an OutputStream
.
IOException
- If an error occurs while writing onto the stream.public void writeDuplicatesOnly(DuDeObjectPair pair) throws IOException
writeDuplicatesOnly
in interface DuDeOutput
pair
- The pair that shall be written to the stream.
IOException
- If an error occurs while writing onto the stream.DuDeObjectPair.getDuplicateInfo()
public void fromJson(DuDeJsonParser<?> jsonParser) throws org.codehaus.jackson.JsonParseException, IOException
Jsonable
DuDeJsonParser
.
fromJson
in interface Jsonable
jsonParser
- The parser that is used for extracting the data out of the Json.
org.codehaus.jackson.JsonParseException
- If an error occurs while parsing the Json.
IOException
- If an error occurs while reading from the stream.public void toJson(DuDeJsonGenerator jsonGenerator) throws org.codehaus.jackson.JsonGenerationException, IOException
Jsonable
DuDeJsonGenerator
.
toJson
in interface Jsonable
jsonGenerator
- The DuDeJsonGenerator
that is used internally.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while writing to the output.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |