public abstract class VOSerializer extends 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 method.
| Modifier and Type | Method and Description | 
|---|---|
| static char | ensureLegalXml(char c)Returns a legal XML character corresponding to an input character. | 
| static String | formatAttribute(String name,
               String value)Turns a name,value pair into an attribute assignment suitable for
 putting in an XML start tag. | 
| static String | formatText(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. | 
| long | getRowCount()Returns the number of rows that this serializer will write, if known. | 
| RowSequence | getRowSequence()Returns the row sequence that this serializer will write. | 
| StarTable | getTable()Returns the table object which this object can serialize. | 
| VOTableVersion | getVersion()Returns the version of the VOTable standard for which this
 serializer will write. | 
| boolean | isCompact()Indicates compactness of whitespace formatting for TABLEDATA format;
 no effect for other DataFormats. | 
| static VOSerializer | makeFitsSerializer(StarTable table,
                  FitsTableSerializer fitser,
                  VOTableVersion version)Constructs a FITS-type VOSerializer. | 
| static VOSerializer | makeSerializer(DataFormat dataFormat,
              StarTable table)Deprecated. 
 | 
| static VOSerializer | makeSerializer(DataFormat dataFormat,
              VOTableVersion version,
              StarTable table)Deprecated. 
 | 
| static VOSerializer | makeSerializer(VOSerializerConfig config,
              StarTable table)Returns a serializer capable of serializing a given table
 in accordance with a supplied configuration object. | 
| void | setCompact(boolean isCompact)Controls whitespace formatting for TABLEDATA format;
 no effect for other DataFormats. | 
| void | writeDescription(BufferedWriter writer)Writes any DESCRIPTION element associated with this serializer's table. | 
| abstract void | writeFields(BufferedWriter writer)Writes the FIELD headers corresponding to this table on a given writer. | 
| abstract void | writeHrefDataElement(BufferedWriter xmlwriter,
                    String href,
                    OutputStream 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(BufferedWriter xmlwriter,
                     String href,
                     OutputStream streamout) | 
| abstract void | writeInlineDataElement(BufferedWriter writer)Writes this serializer's table data as a self-contained 
 <DATA> element. | 
| abstract void | writeInlineDataElementUTF8(OutputStream out)Writes this serializer's table data as a self-contained
 <DATA> element to an output stream using UTF8 encoding. | 
| void | writeInlineTableElement(BufferedWriter writer)Writes this serializer's table as a complete TABLE element. | 
| void | writeInlineTableElementUTF8(OutputStream out)Writes this serializer's table as a complete TABLE element
 to an output stream using UTF8 encoding. | 
| void | writeParams(BufferedWriter writer)Writes any PARAM and INFO elements associated with this serializer's
 table. | 
| void | writePostDataXML(BufferedWriter writer)Outputs any content of the TABLE element following the DATA element
 and the TABLE end tag. | 
| void | writePreDataXML(BufferedWriter writer)Outputs the TABLE element start tag and all of its content before
 the DATA element. | 
| void | writeServiceDescriptors(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 StarTable getTable()
public VOTableVersion getVersion()
public void setCompact(boolean isCompact)
isCompact - if true, add whitespace round TR/TD elementspublic boolean isCompact()
public abstract void writeFields(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic abstract void writeInlineDataElement(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic abstract void writeInlineDataElementUTF8(OutputStream out) throws IOException
writeInlineDataElement(java.io.BufferedWriter) method.out - output streamIOExceptionpublic abstract void writeHrefDataElement(BufferedWriter xmlwriter, String href, OutputStream streamout) throws IOException
UnsupportedOperationException will be thrown.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 dataIOExceptionpublic void writeInlineTableElement(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic void writeInlineTableElementUTF8(OutputStream out) throws IOException
This may be substantially faster than the otherwise equivalent
 writeInlineTableElement(java.io.BufferedWriter) method.
out - output streamIOExceptionpublic void writeHrefTableElement(BufferedWriter xmlwriter, String href, OutputStream streamout) throws IOException
IOExceptionpublic void writeParams(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic void writeDescription(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic void writeServiceDescriptors(BufferedWriter writer) throws IOException
writer - destination streamIOExceptionpublic void writePreDataXML(BufferedWriter writer) throws IOException
writer - output streamIOExceptionpublic void writePostDataXML(BufferedWriter writer) throws IOException
writer - output streamIOExceptionpublic long getRowCount()
getTable().getRowCount(),
 but this may be overridden if that value is known to be unreliable.public RowSequence getRowSequence() throws IOException
IOExceptionpublic static String formatAttribute(String name, String value)
name - the attribute namevalue - the attribute valuepublic static String formatText(String text)
text - the input texttext but with XML special characters escapedpublic static char ensureLegalXml(char c)
c - input characterc if possible@Deprecated public static VOSerializer makeSerializer(DataFormat dataFormat, StarTable table) throws IOException
makeSerializer(VOSerializerConfig,
                                    uk.ac.starlink.table.StarTable)dataFormat - one of the supported VOTable serialization formatstable - the table to be serializedIOException@Deprecated public static VOSerializer makeSerializer(DataFormat dataFormat, VOTableVersion version, StarTable table) throws IOException
makeSerializer(VOSerializerConfig,
                                    uk.ac.starlink.table.StarTable)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 serializedIOExceptionpublic static VOSerializer makeSerializer(VOSerializerConfig config, StarTable table) throws IOException
config - configurationtable - table for outputIOExceptionpublic static VOSerializer makeFitsSerializer(StarTable table, FitsTableSerializer fitser, VOTableVersion version) throws IOException
makeSerializer which will have to construct another,
 possibly an expensive step.table - table for serializationfitser - fits serializerversion - output VOTable versionIOExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.