|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.votable.VOTableWriter
public class VOTableWriter
Implementation of the StarTableWriter interface for VOTables. The dataFormat and inline attributes can be modified to affect how the bulk cell data are output - this may be in TABLEDATA, FITS, BINARY or BINARY2 format, and in the latter three cases may be either inline as base64 encoded CDATA or to a separate stream.
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).
Field Summary | |
---|---|
static String |
DEFAULT_XML_DECLARATION
Default XML declaration in written documents. |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
DataFormat |
getDataFormat()
Returns the format in which this writer will output the bulk table data. |
String |
getFormatName()
Gives the name of the format which is written by this writer. |
boolean |
getInline()
Indicates whether STREAM elements will be written inline or to an external file in the case of FITS and BINARY encoding. |
String |
getMimeType()
Returns a string suitable for use as the value of a MIME Content-Type header. |
static 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. |
String |
getXMLDeclaration()
Returns the XML declaration which is used by this writer at the head of any document written. |
boolean |
looksLikeFile(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(String xmlDecl)
Sets the XML declaration which will be used by this writer at the head of any document written. |
String |
toString()
|
void |
writeInlineStarTable(StarTable startab,
BufferedWriter writer)
Writes a table directly to a stream. |
void |
writeInlineStarTables(StarTable[] startabs,
BufferedWriter writer)
Writes multiple tables directly to a stream. |
protected void |
writePostTableXML(BufferedWriter writer)
Outputs all the text required after the TABLE element in the output table document. |
protected void |
writePreTableXML(BufferedWriter writer)
Outputs all the text required before the TABLE element. |
void |
writeStarTable(StarTable startab,
OutputStream out)
Writes a StarTable to a given stream; must be inline. |
void |
writeStarTable(StarTable startab,
OutputStream out,
File file)
Writes a StarTable to a given stream. |
void |
writeStarTable(StarTable startab,
String location,
StarTableOutput sto)
Writes a StarTable to a given location. |
void |
writeStarTables(TableSequence tableSeq,
OutputStream out)
Writes a sequence of tables to a given stream; must be inline. |
void |
writeStarTables(TableSequence tableSeq,
OutputStream out,
File file)
Writes a sequence of tables to a given stream. |
void |
writeStarTables(TableSequence tableSeq,
String location,
StarTableOutput sto)
Writes a sequence of tables to a given location. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_XML_DECLARATION
Constructor Detail |
---|
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 standardMethod Detail |
---|
public void writeStarTable(StarTable startab, String location, StarTableOutput sto) throws IOException
writeStarTable
in interface StarTableWriter
startab
- the table to writelocation
- the filename to which to write the tablesto
- object used for location resolution
TableFormatException
- if startab cannot be written
to location
IOException
- if there is some I/O errorpublic void writeStarTables(TableSequence tableSeq, String location, StarTableOutput sto) throws IOException
writeStarTables
in interface MultiStarTableWriter
tableSeq
- table sequencelocation
- the filename to which to write the tablesto
- object used for location resolution
IOException
public void writeStarTable(StarTable startab, OutputStream out) throws IOException
writeStarTable(startab,out,(File)null)
.
writeStarTable
in interface StarTableWriter
startab
- the table to writeout
- the stream down which to write the table
TableFormatException
- if this table cannot be written to a
stream
IOException
- if there is some I/O errorpublic void writeStarTables(TableSequence tableSeq, OutputStream out) throws IOException
writeStarTables(tableSeq,out,null)
.
writeStarTables
in interface MultiStarTableWriter
tableSeq
- tables to writeout
- destination stream
IOException
public void writeStarTable(StarTable startab, OutputStream out, File file) throws 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.
IOException
public void writeStarTables(TableSequence tableSeq, OutputStream out, File file) throws 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.
IOException
public void writeInlineStarTable(StarTable startab, BufferedWriter writer) throws IOException
startab
- table to writewriter
- destination stream
IOException
public void writeInlineStarTables(StarTable[] startabs, BufferedWriter writer) throws IOException
startabs
- tableswriter
- destination stream
IOException
protected void writePreTableXML(BufferedWriter writer) throws IOException
writer
- destination stream
IOException
writePostTableXML(java.io.BufferedWriter)
protected void writePostTableXML(BufferedWriter writer) throws IOException
writer
- destination stream
IOException
writePreTableXML(java.io.BufferedWriter)
public boolean looksLikeFile(String filename)
looksLikeFile
in interface StarTableWriter
filename
- name of the file
public String getFormatName()
StarTableWriter
getFormatName
in interface StarTableWriter
public String getMimeType()
StarTableWriter
application/octet-stream
"
(for binary formats) or "text/plain
" for ASCII ones)
is recommended.
getMimeType
in interface 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(String xmlDecl)
DEFAULT_XML_DECLARATION
.
xmlDecl
- new XML declarationpublic 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 String toString()
toString
in class Object
public static StarTableWriter[] getStarTableWriters()
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |