# Class TopcatCodec1

java.lang.Object
uk.ac.starlink.topcat.TopcatCodec1

All Implemented Interfaces:
  `TopcatCodec`

public class TopcatCodec1 extends Object implements TopcatCodec
Original TopcatCodec implementation. This works but serializes all row subsets as bit masks and all columns as literal values. Thus a session round-tripped using this codec gives you back all the table and subset values that you had in the first place, but the expressions are lost, and additional file space is used to serialize these synthetic columns and subsets.

An additional issue is that there is a limit of 64 subsets.

Since:
  16 Jul 2010
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`TopcatCodec1()`

## Method Summary

Modifier and Type
Method
Description
`TopcatModel`
`decode(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow)`
Takes a table which has been previously serialized by calling this codec's `encode` method, and for which the `isEncoded` method returns true, and turns it into a TopcatModel.
`uk.ac.starlink.table.StarTable`
`encode(TopcatModel tcModel, boolean withGlobals)`
Turns a TopcatModel into a StarTable, ready for serialization.
`boolean`
`isCodecUtype(String utype)`
Indicates whether a given utype is a marker for metadata private to the serialization scheme used by this class.
`boolean`
`isEncoded(uk.ac.starlink.table.StarTable table)`
Indicates whether a given table is a candidate for this codec's `decode` method.

### Methods inherited from class Object

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

## Constructor Details

### TopcatCodec1

public TopcatCodec1()

## Method Details

### encode

public uk.ac.starlink.table.StarTable encode(TopcatModel tcModel, boolean withGlobals)
Description copied from interface: `TopcatCodec`
Turns a TopcatModel into a StarTable, ready for serialization. Optionally, the output table may include global information associated with the state of the application as a whole alongside state specific to the provided TopcatModel.

Specified by:
  `encode` in interface `TopcatCodec`
Parameters:
  `tcModel` - model
  `withGlobals` - if true, include global state in the output
Returns:
  table

### isEncoded

public boolean isEncoded(uk.ac.starlink.table.StarTable table)
Description copied from interface: `TopcatCodec`
Indicates whether a given table is a candidate for this codec's `decode` method. It should in general return true for a table that has been returned from this object's `encode` method (possibly following a table write/read cycle) and false for other tables.

Specified by:
  `isEncoded` in interface `TopcatCodec`
Parameters:
  `table` - data+metadata table
Returns:
  true iff it looks like the table was written by this codec and can be decoded by it

### decode

public TopcatModel decode(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow)
Description copied from interface: `TopcatCodec`
Takes a table which has been previously serialized by calling this codec's `encode` method, and for which the `isEncoded` method returns true, and turns it into a TopcatModel. If decoding fails, null is returned.

If used with a ControlWindow that users may be interacting with, this method should be called from the AWT event dispatch thread. This method may (for instance during testing) be called with a null value for the `controlWindow` parameter, but the resulting TopcatModel may not be suitable for all kinds of user interactions.

Specified by:
  `decode` in interface `TopcatCodec`
Parameters:
  `table` - encoded table
  `location` - table location string
  `controlWindow` - control window, or null if necessary
Returns:
  topcat model, or null

### isCodecUtype

public boolean isCodecUtype(String utype)
Indicates whether a given utype is a marker for metadata private to the serialization scheme used by this class.

Parameters:
  `utype` - info utype
Returns:
  true iff utype is for private codec purposes