uk.ac.starlink.votable
Class VOSerializer

java.lang.Object
  |
  +--uk.ac.starlink.votable.VOSerializer

public abstract class VOSerializer
extends Object

Class which knows how to serialize a table's fields and data to a VOTable DATA element. Obtain an instance of this class using the makeSerializer(uk.ac.starlink.votable.DataFormat, uk.ac.starlink.table.StarTable) method.


Method Summary
 DataFormat getFormat()
          Returns the data format which this object can serialize to.
 StarTable getTable()
          Returns the table object which this object can serialize.
static VOSerializer makeSerializer(DataFormat dataFormat, StarTable table)
          Factory method which returns a serializer capable of serializing a given table to a given data format.
abstract  void writeFields(BufferedWriter writer)
          Writes the FIELD headers corresponding to this table on a given writer.
abstract  void writeHrefDataElement(BufferedWriter xmlwriter, String href, DataOutput streamout)
          Writes this serializer's table data to a <DATA> element containing a <STREAM> element which references an external data source (optional method).
abstract  void writeInlineDataElement(BufferedWriter writer)
          Writes this serializer's table data as a self-contained <DATA> element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFormat

public DataFormat getFormat()
Returns the data format which this object can serialize to.

Returns:
output format

getTable

public StarTable getTable()
Returns the table object which this object can serialize.

Returns:
table to write

writeFields

public abstract void writeFields(BufferedWriter writer)
                          throws IOException
Writes the FIELD headers corresponding to this table on a given writer.

Parameters:
writer - destination stream
IOException

writeInlineDataElement

public abstract void writeInlineDataElement(BufferedWriter writer)
                                     throws IOException
Writes this serializer's table data as a self-contained <DATA> element. If this serializer's format is binary (non-XML) the bytes will get written base64-encoded into a STREAM element.

Parameters:
writer - destination stream
IOException

writeHrefDataElement

public abstract void writeHrefDataElement(BufferedWriter xmlwriter,
                                          String href,
                                          DataOutput streamout)
                                   throws IOException
Writes this serializer's table data to a <DATA> element containing a <STREAM> element which references an external data source (optional method). The binary data itself will be written to an output stream supplied separately (it will not be inline). If this serializer's format is not binary (i.e. if it's TABLEDATA) an UnsupportedOperationException will be thrown.

Parameters:
xmlwriter - destination stream for the XML output
href - URL for the external stream (output as the href attribute of the written <STREAM> element)
streamout - destination stream for the binary table data
IOException

makeSerializer

public static VOSerializer makeSerializer(DataFormat dataFormat,
                                          StarTable table)
                                   throws IOException
Factory method which returns a serializer capable of serializing a given table to a given data format.

Parameters:
dataFormat - one of the supported VOTable serialization formats
table - the table to be serialized
IOException

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.