uk.ac.starlink.table.formats

## Class DocumentedStreamStarTableWriter

- java.lang.Object
- - uk.ac.starlink.table.formats.DocumentedStreamStarTableWriter

- All Implemented Interfaces:
    Documented, DocumentedIOHandler, StarTableWriter
  Direct Known Subclasses:
    AbstractTextTableWriter, CsvTableWriter, EcsvTableWriter, FeatherTableWriter, HTMLTableWriter, LatexTableWriter, MirageTableWriter, TstTableWriter

      public abstract class DocumentedStreamStarTableWriter
      extends java.lang.Object
      implements StarTableWriter, DocumentedIOHandler

  Partial StarTableWriter implementation for use by writers which just write to output streams, and which also implements DocumentedIOHandler.
  Since:
    22 Sep 2020

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DocumentedStreamStarTableWriter(java.lang.String[] extensions)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String[]` | `getExtensions()` Returns the list of filename extensions recognised by this handler.
    `boolean` | `looksLikeFile(java.lang.String filename)` Indicates whether the destination is of a familiar form for this kind of writer.
    `void` | `writeStarTable(StarTable table, java.lang.String location, StarTableOutput sto)` Writes a `StarTable` object to a given location.

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface uk.ac.starlink.table.StarTableWriter

      `getFormatName, getMimeType, writeStarTable`

    - ### Methods inherited from interface uk.ac.starlink.table.formats.DocumentedIOHandler

      `docIncludesExample, matchesExtension, readText, toLink`

    - ### Methods inherited from interface uk.ac.starlink.table.Documented

      `getXmlDescription`

- - ### Constructor Detail

    - #### DocumentedStreamStarTableWriter

          protected DocumentedStreamStarTableWriter(java.lang.String[] extensions)

      Constructor.
      Parameters:
        `extensions` - list of lower-cased filename extensions, excluding the '.' character

  - ### Method Detail

    - #### getExtensions

          public java.lang.String[] getExtensions()

      Description copied from interface: `DocumentedIOHandler`
      Returns the list of filename extensions recognised by this handler.
      Specified by:
        `getExtensions` in interface `DocumentedIOHandler`
      Returns:
        lower-cased filename extension strings, no "." characters

    - #### looksLikeFile

          public boolean looksLikeFile(java.lang.String filename)

      Description copied from interface: `StarTableWriter`
      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 return `true` for values of `location` which look like the normal form for their output format, for instance one with the usual file extension.
      Specified by:
        `looksLikeFile` in interface `StarTableWriter`
      Parameters:
        `filename` - the location name (probably filename)
      Returns:
        `true` iff it looks like a file this writer would normally write

    - #### writeStarTable

          public void writeStarTable(StarTable table,
                                     java.lang.String location,
                                     StarTableOutput sto)
                              throws java.io.IOException

      Description copied from interface: `StarTableWriter`
      Writes a `StarTable` object to a given location. Implementations are free to interpret the `location` argument 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 the `sto` argument should normally be used to turn `location` into a stream. `StreamStarTableWriter` provides a suitable implementation for this case.
      Specified by:
        `writeStarTable` in interface `StarTableWriter`
      Parameters:
        `table` - table to write
        `location` - destination for `startab`
        `sto` - StarTableOutput which dispatched this request
      Throws:
        `TableFormatException` - if `startab` cannot be written to `location`
        `java.io.IOException` - if there is some I/O error