#
Saving and Restoring Objects (Channels)

Facilities are provided by the AST library for performing input and output (I/O) with any kind of ObjectObject. This means it is possible to write any Object into various external representations for storage, and then to read these representations back in, so as to restore the original Object. Typically, an Object would be written by one program and read back in by another.

We refer to “external representations” in the plural because AST is designed to function independently of any particular data storage system. This means that Objects may need converting into a number of different external representations in order to be compatible with (say) the astronomical data storage system in which they will reside.

In this section, we discuss the basic I/O facilities which support external representations based on a textual format referred to as the AST “native format”. These are implemented using a new kind of Object—a ChannelChannel. We will examine later how to use other representations, based on an XML format or on the use of FITS headers, for storing Objects. These are implemented using more specialised forms of Channel called XmlChanXmlChan (§18) and FitsChanFitsChan (§16).

Subsections

- The Channel Model
- Creating a Channel
- Writing Objects to a Channel
- Reading Objects from a Channel
- Saving and Restoring Multiple Objects
- Validating Input
- Storing an ID String with an Object
- The Textual Output Format
- Controlling the Amount of Output
- Controlling Commenting
- Editing Textual Output
- Mixing Objects with other Text
- Reading Objects from Files
- Writing Objects to Files
- Reading and Writing Objects to other Places