de.hpi.fgis.dude.output
Class JsonOutput

java.lang.Object
  extended by de.hpi.fgis.dude.output.AbstractDuDeOutput
      extended by de.hpi.fgis.dude.output.JsonOutput
All Implemented Interfaces:
DuDeOutput, AutoJsonable, Jsonable

public class JsonOutput
extends AbstractDuDeOutput

JsonOutput converts the passed DuDeObject pairs into Json syntax. There are two different modes for writing the information to the stream. The default mode writes only the identifying information while the other one prints the whole data of each DuDeObject

Author:
Matthias Pohl

Field Summary
protected static String DEFAULT_FOOTER
          The default footer of the JsonOutput.
protected static String DEFAULT_HEADER
          The default header of the JsonOutput.
static String FIRST_OBJECT_ATTRIBUTE
          The attribute name of the first object within each pair.
static String SECOND_OBJECT_ATTRIBUTE
          The attribute name of the second object within each pair.
static String SIMILARITY_ATTRIBUTE
          The attribute name of the similarity that belongs to each pair
 
Fields inherited from class de.hpi.fgis.dude.output.AbstractDuDeOutput
outputStream
 
Constructor Summary
protected JsonOutput()
          Internal constructor for Jsonable deserialization.
  JsonOutput(File out)
          Initializes a JsonOutput formatter.
  JsonOutput(OutputStream out)
          Initializes a JsonOutput formatter.
 
Method Summary
protected  String getDefaultFooter()
          Returns DEFAULT_FOOTER.
protected  String getDefaultHeader()
          Returns DEFAULT_HEADER.
 void write(DuDeObjectPair pair)
          Writes the DuDeObjectPair onto an stream.
 
Methods inherited from class de.hpi.fgis.dude.output.AbstractDuDeOutput
close, fromJson, printDataEnabled, toJson, withData, withoutData, writeDuplicatesOnly, writelnToStream, writeToStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HEADER

protected static final String DEFAULT_HEADER
The default header of the JsonOutput.

See Also:
Constant Field Values

DEFAULT_FOOTER

protected static final String DEFAULT_FOOTER
The default footer of the JsonOutput.

See Also:
Constant Field Values

FIRST_OBJECT_ATTRIBUTE

public static final String FIRST_OBJECT_ATTRIBUTE
The attribute name of the first object within each pair.

See Also:
Constant Field Values

SECOND_OBJECT_ATTRIBUTE

public static final String SECOND_OBJECT_ATTRIBUTE
The attribute name of the second object within each pair.

See Also:
Constant Field Values

SIMILARITY_ATTRIBUTE

public static final String SIMILARITY_ATTRIBUTE
The attribute name of the similarity that belongs to each pair

See Also:
Constant Field Values
Constructor Detail

JsonOutput

public JsonOutput(OutputStream out)
           throws IOException
Initializes a JsonOutput formatter. This instance writes only the identifying information of each object to the stream.

Parameters:
out - The stream to which the data shall be written.
Throws:
IOException - If an error occurs while writing to the OutputStream.

JsonOutput

public JsonOutput(File out)
           throws IOException
Initializes a JsonOutput formatter. This instance writes only the identifying information of each object to the stream.

Parameters:
out - The file to which the data shall be written.
Throws:
IOException - If an error occurs while writing to the OutputStream.

JsonOutput

protected JsonOutput()
Internal constructor for Jsonable deserialization.

Method Detail

getDefaultHeader

protected String getDefaultHeader()
Returns DEFAULT_HEADER.

Overrides:
getDefaultHeader in class AbstractDuDeOutput
Returns:
Returns an empty String.

getDefaultFooter

protected String getDefaultFooter()
Returns DEFAULT_FOOTER.

Overrides:
getDefaultFooter in class AbstractDuDeOutput
Returns:
Returns an empty String.

write

public void write(DuDeObjectPair pair)
           throws IOException
Description copied from interface: DuDeOutput
Writes the DuDeObjectPair onto an stream.

Specified by:
write in interface DuDeOutput
Specified by:
write in class AbstractDuDeOutput
Parameters:
pair - A pair of two DuDeObjects that are written into an OutputStream.
Throws:
IOException - If an error occurs while writing onto the stream.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.