##
Reading Native Objects From a FitsChan

Once you have stored a FITS header description of an ObjectObject in a FitsChanFitsChan using the native encoding (§16.5), you can read it back using astReadastRead in much the same way as with a basic ChannelChannel (§15.4). Similar comments about validating the Object you read also apply (§15.6). If you have just written to the FitsChan, you must remember to rewind it first:

262#262

An important feature of a FitsChan is that read operations are destructive. This means that if an Object description is found, it will be consumed by astRead which will remove all the cards involved, including associated COMMENT cards, from the FitsChan. Thus, if you write an Object to a FitsChan, rewind, and read the same Object back, you should end up with the original FitsChan contents. If you need to circumvent this behaviour for any reason, it is a simple matter to make a copy of a FitsChan using astCopyastCopy (§4.13). If you then read from the copy, the original FitsChan will remain untouched.

After a read completes, the FitsChan's CardCard attribute identifies the card immediately following the last card read, or the end-of-file of there are no more cards.

Since the native encoding is being used, any long strings involved in the object description will have been split into two or more adjacent contuation cards when the Object was stored in the header using function astWriteastWrite. The astRead function reverses this process by concatenating any such adjacent continuation cards to re-create the original long string.