public class HTMLFormat extends java.lang.Object implements OutputFormat
Modifier and Type | Field and Description |
---|---|
protected ServiceConnection |
service
The
ServiceConnection to use (for the log and to have some information about the service (particularly: name, description). |
Constructor and Description |
---|
HTMLFormat(ServiceConnection service)
Creates an HTML formatter.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Gets a description of this format.
|
java.lang.String |
getFileExtension()
Gets a file extension for this format.
|
java.lang.String |
getMimeType()
Gets the MIME type corresponding to this format.
|
java.lang.String |
getShortMimeType()
Gets a short expression of its MIME type.
|
protected void |
writeData(TableIterator result,
DBColumn[] selectedColumns,
java.io.BufferedWriter writer,
TAPExecutionReport execReport,
java.lang.Thread thread)
Write all the data rows.
|
protected DBColumn[] |
writeHeader(TableIterator result,
java.io.BufferedWriter writer,
TAPExecutionReport execReport,
java.lang.Thread thread)
Write the whole header (one row whose columns are just the columns' name).
|
void |
writeResult(TableIterator result,
java.io.OutputStream output,
TAPExecutionReport execReport,
java.lang.Thread thread)
Formats the given query result and writes it in the given output stream.
|
protected final ServiceConnection service
ServiceConnection
to use (for the log and to have some information about the service (particularly: name, description).public HTMLFormat(ServiceConnection service) throws java.lang.NullPointerException
service
- Description of the TAP service.java.lang.NullPointerException
- If the given service connection is null
.public java.lang.String getMimeType()
OutputFormat
getMimeType
in interface OutputFormat
public java.lang.String getShortMimeType()
OutputFormat
getShortMimeType
in interface OutputFormat
public java.lang.String getDescription()
OutputFormat
getDescription
in interface OutputFormat
public java.lang.String getFileExtension()
OutputFormat
getFileExtension
in interface OutputFormat
public void writeResult(TableIterator result, java.io.OutputStream output, TAPExecutionReport execReport, java.lang.Thread thread) throws TAPException, java.io.IOException, java.lang.InterruptedException
OutputFormat
Formats the given query result and writes it in the given output stream.
Note: the given output stream should not be closed at the end of this function. It is up to the called to do it.
writeResult
in interface OutputFormat
result
- The raw (table) result to format.output
- The output stream (a ServletOutputStream or a stream on a file) in which the formatted result must be written.execReport
- The report of the execution of the TAP query whose the result must be now written.thread
- The thread which has asked the result writing.TAPException
- If there is an error while formatting the query result.java.io.IOException
- If any error occurs while writing into the given stream.java.lang.InterruptedException
- If the query has been interrupted/aborted.protected DBColumn[] writeHeader(TableIterator result, java.io.BufferedWriter writer, TAPExecutionReport execReport, java.lang.Thread thread) throws java.io.IOException, TAPException, java.lang.InterruptedException
result
- Result to write later (but it contains also metadata that was extracted from the result itself).writer
- Output in which the metadata must be written.execReport
- Execution report (which contains the metadata extracted/guessed from the ADQL query).thread
- Thread which has asked for this formatting (it must be used in order to test the Thread.isInterrupted()
flag and so interrupt everything if need).java.io.IOException
- If there is an error while writing something in the output.java.lang.InterruptedException
- If the thread has been interrupted.TAPException
- If any other error occurs.protected void writeData(TableIterator result, DBColumn[] selectedColumns, java.io.BufferedWriter writer, TAPExecutionReport execReport, java.lang.Thread thread) throws java.io.IOException, TAPException, java.lang.InterruptedException
result
- Result to write.selectedColumns
- All columns' metadata.writer
- Print writer in which the data must be written.execReport
- Execution report (which contains the maximum allowed number of records to output).thread
- Thread which has asked for this formatting (it must be used in order to test the Thread.isInterrupted()
flag and so interrupt everything if need).java.io.IOException
- If there is an error while writing something in the output stream.java.lang.InterruptedException
- If the thread has been interrupted.TAPException
- If any other error occurs.