Next Previous Up Contents
Next: DATA Element Serialization Formats
Up: StarTable Representation of VOTables
Previous: Column Metadata

#### 7.1.4 Data Types

The class and shape of each column in a `StarTable` (accessed using the `get/setContentClass()` and `get/setShape()` methods of `ColumnInfo`) correspond to the `datatype` and `arraysize` attributes of the corresponding FIELD element in the VOTable. You are not expected to access the `datatype` and `arraysize` attributes directly.

How Java classes map to VOTable data types for the content of columns is similar to elsewhere in STIL. In general, scalars are represented by the corresponding primitive wrapper class (`Integer`, `Double`, `Boolean` etc), and arrays are represented by an array of primitives of the corresponding type (`int[]`, `double[]`, `boolean[]`). Arrays are only ever one-dimensional - information about any multidimensional shape they may have is supplied separately (use the `getShape` method on the corresponding `ColumnInfo`). There are a couple of exceptions to this: arrays with `datatype="char"` or `"unicodeChar"` are represented by String objects since that is almost always what is intended (n-dimensional arrays of `char` are treated as if they were (n-1)-dimensional arrays of Strings), and `unsignedByte` types are represented as if they were `short`s, since in Java bytes are always signed. Complex values are represented as if they were an array of the corresponding type but with an extra dimension of size two (the most rapidly varying).

The following table summarises how all VOTable datatypes are represented:

        datatype        Class for scalar   Class for arraysize>1
        --------        ----------------   ---------------------
        boolean         Boolean            boolean[]
        bit             boolean[]          boolean[]
        unsignedByte    Short              short[]
        short           Short              short[]
        int             Integer            int[]
        long            Long               long[]
        char            Char               String or String[]
        unicodeChar     Char               String or String[]
        float           Float              float[]
        double          Double             double[]
        floatComplex    float[]            float[]
        doubleComplex   double[]           double[]

Next Previous Up Contents
Next: DATA Element Serialization Formats
Up: StarTable Representation of VOTables
Previous: Column Metadata

STIL - Starlink Tables Infrastructure Library
Starlink User Note252
STIL web page: http://www.starlink.ac.uk/stil/
Author email: m.b.taylor@bristol.ac.uk