# Class TapWriter

java.lang.Object
uk.ac.starlink.ttools.example.TapWriter

public class TapWriter extends Object
Writes SQL ResultSets to VOTable with the INFO elements appropriate for TAP output. It's all streamed, so no appreciable amount of memory should be required, and a maximum record count can be imposed.

Since:
  5 Feb 2013
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`TapWriter(uk.ac.starlink.votable.DataFormat dfmt, uk.ac.starlink.votable.VOTableVersion version, long maxrec)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static void`
`main(String[] args)`
Test harness.
`void`
`writeVOTable(ResultSet rset, OutputStream ostrm)`
Writes a result set to an output stream as a VOTable.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TapWriter

public TapWriter(uk.ac.starlink.votable.DataFormat dfmt, uk.ac.starlink.votable.VOTableVersion version, long maxrec)
Constructor.

Parameters:
  `dfmt` - selects VOTable serialization format (TABLEDATA, BINARY, BINARY2, FITS)
  `version` - selects VOTable version
  `maxrec` - maximum record count before overflow; negative value means no limit

## Method Details

### writeVOTable

public void writeVOTable(ResultSet rset, OutputStream ostrm) throws IOException, SQLException
Writes a result set to an output stream as a VOTable.

Parameters:
  `rset` - result set
  `ostrm` - destination stream
Throws:
  `IOException`
  `SQLException`

### main

public static void main(String[] args) throws IOException, SQLException
Test harness. Run with -help for usage. Don't forget to put a JDBC driver on the classpath and set the system property jdbc.drivers.

Throws:
  `IOException`
  `SQLException`