public class VOTableWriter
extends java.lang.Object
implements uk.ac.starlink.table.StarTableWriter, uk.ac.starlink.table.MultiStarTableWriter
A couple of Auxiliary metadata items of the ColumnInfo metadata from written tables are respected:
Tables.NULL_VALUE_INFO
:
sets the value of "magic" blank value for
integer columnsTables.UBYTE_FLAG_INFO
:
if set to Boolean.TRUE
and if the column has content class
Short
or short[]
, the data will be written
with datatype="unsignedByte"
instead of
(signed 16-bit) "short"
.COOSYS_*_INFO
items defined in the
VOStarTable
class;
suitable COOSYS elements will be written and referenced as required
to honour these items.*_INFO
items defined in the
VOStarTable
class;
this has the effect that VOTable column attributes read in from
a VOTable will be passed through if the same table is written
out to a VOTable (or VOTable-based format like FITS-plus).Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_XML_DECLARATION
Default XML declaration in written documents.
|
Constructor and Description |
---|
VOTableWriter()
Constructs a default VOTableWriter.
|
VOTableWriter(DataFormat dataFormat,
boolean inline)
Constructs a VOTableWriter with specified output type and default
VOTable version.
|
VOTableWriter(DataFormat dataFormat,
boolean inline,
VOTableVersion version)
Constructs a VOTableWriter with specified output characterstics
and a given version of the VOTable standard.
|
Modifier and Type | Method and Description |
---|---|
DataFormat |
getDataFormat()
Returns the format in which this writer will output the bulk table data.
|
java.lang.String |
getFormatName() |
boolean |
getInline()
Indicates whether STREAM elements will be written inline or to
an external file in the case of FITS and BINARY encoding.
|
java.lang.String |
getMimeType() |
static uk.ac.starlink.table.StarTableWriter[] |
getStarTableWriters()
Returns a list of votable writers with variant values of attributes.
|
VOTableVersion |
getVotableVersion()
Returns the version of the VOTable standard to which the output
of this writer conforms.
|
boolean |
getWriteSchemaLocation()
Indicates whether the schema location attribute will be written
on opening VOTABLE tags.
|
java.lang.String |
getXMLDeclaration()
Returns the XML declaration which is used by this writer
at the head of any document written.
|
boolean |
looksLikeFile(java.lang.String filename)
Returns true for filenames with the extension ".xml", ".vot" or
".votable";
|
void |
setDataFormat(DataFormat format)
Sets the format in which the table data will be output.
|
void |
setInline(boolean inline)
Sets whether STREAM elements should be written inline or to an
external file in the case of FITS and BINARY encoding.
|
void |
setVotableVersion(VOTableVersion version)
Sets the version of the VOTable standard to which the output
of this writer will conform.
|
void |
setWriteSchemaLocation(boolean writeSchemaLocation)
Determines whether the schema location attribute will be written
on opening VOTABLE tags.
|
void |
setXMLDeclaration(java.lang.String xmlDecl)
Sets the XML declaration which will be used by this writer
at the head of any document written.
|
java.lang.String |
toString() |
void |
writeInlineStarTable(uk.ac.starlink.table.StarTable startab,
java.io.BufferedWriter writer)
Writes a table directly to a stream.
|
void |
writeInlineStarTables(uk.ac.starlink.table.StarTable[] startabs,
java.io.BufferedWriter writer)
Writes multiple tables directly to a stream.
|
protected void |
writePostTableXML(java.io.BufferedWriter writer)
Outputs all the text required after the TABLE element in the
output table document.
|
protected void |
writePreTableXML(java.io.BufferedWriter writer)
Outputs all the text required before the TABLE element.
|
void |
writeStarTable(uk.ac.starlink.table.StarTable startab,
java.io.OutputStream out)
Writes a StarTable to a given stream; must be inline.
|
void |
writeStarTable(uk.ac.starlink.table.StarTable startab,
java.io.OutputStream out,
java.io.File file)
Writes a StarTable to a given stream.
|
void |
writeStarTable(uk.ac.starlink.table.StarTable startab,
java.lang.String location,
uk.ac.starlink.table.StarTableOutput sto)
Writes a StarTable to a given location.
|
void |
writeStarTables(uk.ac.starlink.table.TableSequence tableSeq,
java.io.OutputStream out)
Writes a sequence of tables to a given stream; must be inline.
|
void |
writeStarTables(uk.ac.starlink.table.TableSequence tableSeq,
java.io.OutputStream out,
java.io.File file)
Writes a sequence of tables to a given stream.
|
void |
writeStarTables(uk.ac.starlink.table.TableSequence tableSeq,
java.lang.String location,
uk.ac.starlink.table.StarTableOutput sto)
Writes a sequence of tables to a given location.
|
public static final java.lang.String DEFAULT_XML_DECLARATION
public VOTableWriter()
public VOTableWriter(DataFormat dataFormat, boolean inline)
dataFormat
- the format in which tables will be writteninline
- whether output of streamed formats should be
inline and base64-encoded or notpublic VOTableWriter(DataFormat dataFormat, boolean inline, VOTableVersion version)
dataFormat
- the format in which tables will be writteninline
- whether output of streamed formats should be
inline and base64-encoded or notversion
- version of the VOTable standardpublic void writeStarTable(uk.ac.starlink.table.StarTable startab, java.lang.String location, uk.ac.starlink.table.StarTableOutput sto) throws java.io.IOException
writeStarTable
in interface uk.ac.starlink.table.StarTableWriter
startab
- the table to writelocation
- the filename to which to write the tablesto
- object used for location resolutionjava.io.IOException
public void writeStarTables(uk.ac.starlink.table.TableSequence tableSeq, java.lang.String location, uk.ac.starlink.table.StarTableOutput sto) throws java.io.IOException
writeStarTables
in interface uk.ac.starlink.table.MultiStarTableWriter
tableSeq
- table sequencelocation
- the filename to which to write the tablesto
- object used for location resolutionjava.io.IOException
public void writeStarTable(uk.ac.starlink.table.StarTable startab, java.io.OutputStream out) throws java.io.IOException
writeStarTable(startab,out,(File)null)
.writeStarTable
in interface uk.ac.starlink.table.StarTableWriter
startab
- the table to writeout
- the stream down which to write the tablejava.io.IOException
public void writeStarTables(uk.ac.starlink.table.TableSequence tableSeq, java.io.OutputStream out) throws java.io.IOException
writeStarTables(tableSeq,out,null)
.writeStarTables
in interface uk.ac.starlink.table.MultiStarTableWriter
tableSeq
- tables to writeout
- destination streamjava.io.IOException
public void writeStarTable(uk.ac.starlink.table.StarTable startab, java.io.OutputStream out, java.io.File file) throws java.io.IOException
startab
- the table to writeout
- the stream down which to write the tablefile
- the filename to which out refers; this is used
if necessary to come up with a suitable filename for
related files which need to be written. May be null.java.io.IOException
public void writeStarTables(uk.ac.starlink.table.TableSequence tableSeq, java.io.OutputStream out, java.io.File file) throws java.io.IOException
tableSeq
- table sequence to writeout
- destination streamfile
- the filename to which out refers; this is used
if necessary to come up with a suitable filename for
related files which need to be written. May be null.java.io.IOException
public void writeInlineStarTable(uk.ac.starlink.table.StarTable startab, java.io.BufferedWriter writer) throws java.io.IOException
startab
- table to writewriter
- destination streamjava.io.IOException
public void writeInlineStarTables(uk.ac.starlink.table.StarTable[] startabs, java.io.BufferedWriter writer) throws java.io.IOException
startabs
- tableswriter
- destination streamjava.io.IOException
protected void writePreTableXML(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
writePostTableXML(java.io.BufferedWriter)
protected void writePostTableXML(java.io.BufferedWriter writer) throws java.io.IOException
writer
- destination streamjava.io.IOException
writePreTableXML(java.io.BufferedWriter)
public boolean looksLikeFile(java.lang.String filename)
looksLikeFile
in interface uk.ac.starlink.table.StarTableWriter
filename
- name of the filepublic java.lang.String getFormatName()
getFormatName
in interface uk.ac.starlink.table.StarTableWriter
public java.lang.String getMimeType()
getMimeType
in interface uk.ac.starlink.table.StarTableWriter
public void setDataFormat(DataFormat format)
format
- bulk data formatpublic DataFormat getDataFormat()
public void setInline(boolean inline)
inline
- true iff streamed data will be encoded
inline in the STREAM elementpublic boolean getInline()
public void setXMLDeclaration(java.lang.String xmlDecl)
DEFAULT_XML_DECLARATION
.xmlDecl
- new XML declarationpublic java.lang.String getXMLDeclaration()
public void setVotableVersion(VOTableVersion version)
version
- new versionpublic VOTableVersion getVotableVersion()
public void setWriteSchemaLocation(boolean writeSchemaLocation)
writeSchemaLocation
- whether to write xsi:schemaLocation attspublic boolean getWriteSchemaLocation()
public java.lang.String toString()
toString
in class java.lang.Object
public static uk.ac.starlink.table.StarTableWriter[] getStarTableWriters()
Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.