public abstract class VOSerializer
extends java.lang.Object
VOTableWriter
class may be more convenient, but
this class can be used in a more flexible way, by writing only
the elements which are required.
Obtain an instance of this class using the makeSerializer(uk.ac.starlink.votable.DataFormat, uk.ac.starlink.table.StarTable)
method.
Modifier and Type | Method | Description |
---|---|---|
static char |
ensureLegalXml(char c) |
Returns a legal XML character corresponding to an input character.
|
static java.lang.String |
formatAttribute(java.lang.String name,
java.lang.String value) |
Turns a name,value pair into an attribute assignment suitable for
putting in an XML start tag.
|
static java.lang.String |
formatText(java.lang.String text) |
Performs necessary special character escaping for text which
will be written as XML CDATA.
|
DataFormat |
getFormat() |
Returns the data format which this object can serialize to.
|
uk.ac.starlink.table.StarTable |
getTable() |
Returns the table object which this object can serialize.
|
static VOSerializer |
makeFitsSerializer(uk.ac.starlink.table.StarTable table,
uk.ac.starlink.fits.FitsTableSerializer fitser) |
Constructs a FITS-type VOSerializer.
|
static VOSerializer |
makeSerializer(DataFormat dataFormat,
uk.ac.starlink.table.StarTable table) |
Returns a serializer capable of serializing a given table to
given data format, using the default VOTable output version.
|
static VOSerializer |
makeSerializer(DataFormat dataFormat,
VOTableVersion version,
uk.ac.starlink.table.StarTable table) |
Returns a serializer capable of serializing
a given table to a given data format using a given VOTable version.
|
void |
writeDescription(java.io.BufferedWriter writer) |
Writes any DESCRIPTION element associated with this serializer's table.
|
abstract void |
writeFields(java.io.BufferedWriter writer) |
Writes the FIELD headers corresponding to this table on a given writer.
|
abstract void |
writeHrefDataElement(java.io.BufferedWriter xmlwriter,
java.lang.String href,
java.io.DataOutput streamout) |
Writes this serializer's table data to a <DATA> element
containing a <STREAM> element which references an external
data source (optional method).
|
void |
writeHrefTableElement(java.io.BufferedWriter xmlwriter,
java.lang.String href,
java.io.DataOutput streamout) |
|
abstract void |
writeInlineDataElement(java.io.BufferedWriter writer) |
Writes this serializer's table data as a self-contained
<DATA> element.
|
void |
writeInlineTableElement(java.io.BufferedWriter writer) |
Writes this serializer's table as a complete TABLE element.
|
void |
writeParams(java.io.BufferedWriter writer) |
Writes any PARAM and INFO elements associated with this serializer's
table.
|
void |
writePostDataXML(java.io.BufferedWriter writer) |
Outputs any content of the TABLE element following the DATA element
and the TABLE end tag.
|
void |
writePreDataXML(java.io.BufferedWriter writer) |
Outputs the TABLE element start tag and all of its content before
the DATA element.
|
void |
writeServiceDescriptors(java.io.BufferedWriter writer) |
Writes the service descriptor parameters of this serializer's table
as a sequence of zero or more RESOURCE elements.
|
public DataFormat getFormat()
public uk.ac.starlink.table.StarTable getTable()
public abstract void writeFields(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public abstract void writeInlineDataElement(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public abstract void writeHrefDataElement(java.io.BufferedWriter xmlwriter, java.lang.String href, java.io.DataOutput streamout) throws java.io.IOException
xmlwriter
- destination stream for the XML outputhref
- URL for the external stream (output as the href
attribute of the written <STREAM> element)streamout
- destination stream for the binary table datajava.io.IOException
public void writeInlineTableElement(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public void writeHrefTableElement(java.io.BufferedWriter xmlwriter, java.lang.String href, java.io.DataOutput streamout) throws java.io.IOException
java.io.IOException
public void writeParams(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public void writeDescription(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public void writeServiceDescriptors(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
public void writePreDataXML(java.io.BufferedWriter writer) throws java.io.IOException
writer
- output streamjava.io.IOException
public void writePostDataXML(java.io.BufferedWriter writer) throws java.io.IOException
writer
- output streamjava.io.IOException
public static java.lang.String formatAttribute(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the attribute valuepublic static java.lang.String formatText(java.lang.String text)
text
- the input textpublic static char ensureLegalXml(char c)
c
- input characterc
if possiblepublic static VOSerializer makeSerializer(DataFormat dataFormat, uk.ac.starlink.table.StarTable table) throws java.io.IOException
dataFormat
- one of the supported VOTable serialization formatstable
- the table to be serializedjava.io.IOException
public static VOSerializer makeSerializer(DataFormat dataFormat, VOTableVersion version, uk.ac.starlink.table.StarTable table) throws java.io.IOException
dataFormat
- one of the supported VOTable serialization formatsversion
- specifies the version of the VOTable standard
to which the output will conformtable
- the table to be serializedjava.io.IOException
public static VOSerializer makeFitsSerializer(uk.ac.starlink.table.StarTable table, uk.ac.starlink.fits.FitsTableSerializer fitser) throws java.io.IOException
makeSerializer
which will have to construct another,
possibly an expensive step.table
- table for serializationfitser
- fits serializerjava.io.IOException
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.