Interface StarTableWriter
- All Known Subinterfaces:
MultiStarTableWriter
- All Known Implementing Classes:
AbstractTextTableWriter, AsciiTableWriter, CsvTableWriter, DocumentedStreamStarTableWriter, HTMLTableWriter, IpacTableWriter, LatexTableWriter, StreamStarTableWriter, TextTableWriter, TstTableWriter
public interface StarTableWriter
Defines an object which can output a
StarTable in a particular
format.- Author:
- Mark Taylor (Starlink)
-
Method Summary
Modifier and TypeMethodDescriptionGives the name of the format which is written by this writer.Returns a string suitable for use as the value of a MIME Content-Type header.booleanlooksLikeFile(String location) Indicates whether the destination is of a familiar form for this kind of writer.voidwriteStarTable(StarTable startab, OutputStream out) Writes aStarTableobject to a given output stream.voidwriteStarTable(StarTable startab, String location, StarTableOutput sto) Writes aStarTableobject to a given location.
-
Method Details
-
writeStarTable
Writes aStarTableobject to a given output stream. The implementation can assume thatoutis suitable for direct writing (for instance it should not normally wrap it in aBufferedOutputStream), and should not close it at the end of the call.Not all table writers are capable of writing to a stream; an implementation may throw a
TableFormatExceptionto indicate that it cannot do so.- Parameters:
startab- the table to writeout- the output stream to whichstartabshould be written- Throws:
TableFormatException- if this table cannot be written to a streamIOException- if there is some I/O error
-
writeStarTable
void writeStarTable(StarTable startab, String location, StarTableOutput sto) throws TableFormatException, IOException Writes aStarTableobject to a given location. Implementations are free to interpret thelocationargument in any way appropriate for them. Typically however the location will simply be used to get an output stream (for instance interpreting it as a filename). In this case thestoargument should normally be used to turnlocationinto a stream.StreamStarTableWriterprovides a suitable implementation for this case.- Parameters:
startab- table to writelocation- destination forstartabsto- StarTableOutput which dispatched this request- Throws:
TableFormatException- ifstartabcannot be written tolocationIOException- if there is some I/O error
-
looksLikeFile
Indicates whether the destination is of a familiar form for this kind of writer. This may be used to guess what kind of format a table should be written in. Implementations should returntruefor values oflocationwhich look like the normal form for their output format, for instance one with the usual file extension.- Parameters:
location- the location name (probably filename)- Returns:
trueiff it looks like a file this writer would normally write
-
getFormatName
String getFormatName()Gives the name of the format which is written by this writer. Matching against this string may be used by callers to identify or select this writer from a list.- Returns:
- a short string identifying the output format of this writer
-
getMimeType
String getMimeType()Returns a string suitable for use as the value of a MIME Content-Type header. If no suitable MIME type is available or known, one of "application/octet-stream" (for binary formats) or "text/plain" for ASCII ones) is recommended.- Returns:
- MIME content type
-