Routines (alphabetical) > Object Classes > Miscellaneous Object Classes > IDL_Savefile

# IDL_Savefile

Superclasses | Creation | Properties | Methods | Example | Version History | See Also

The IDL_Savefile object provides complete query and restore capabilities for IDL SAVE files. IDL SAVE files are binary format files created with the SAVE procedure; they can contain data or IDL routines. Using IDL_Savefile, you can retrieve information about the user, machine, and system that created the SAVE file, as well as the number and size of the various items contained in the file (variables, common blocks, routines, etc.). You can also selectively restore individual items from the SAVE file.

Use IDL_Savefile instead of the RESTORE procedure when you need to obtain detailed information on the items contained within a SAVE file without first restoring it, or when you wish to restore only selected items. Use RESTORE when you want to restore everything from the SAVE file using a simple interface.

## Superclasses

None

## Creation

See IDL_Savefile::Init.

## Properties

Objects of this class have no properties of their own.

## Methods

This class has the following methods:

- IDL_Savefile::Cleanup
- IDL_Savefile::Contents
- IDL_Savefile::Init
- IDL_Savefile::Names
- IDL_Savefile::Restore
- IDL_Savefile::Size

In addition, this class inherits the methods of its superclasses (if any).

## Example

Use the IDL_Savefile object to query the contents of a SAVE file containing data and selectively restore variables.

Typically, IDL_Savefile::Contents is the first method called on a savefile object; the information retrieved indicates the number of different types of items contained in the file (variables, routines, etc.). Next, a call to IDL_Savefile::Names is used to obtain the names of items of a specific type. IDL_Savefile::Size can be used to determine the size of variables in the file, and IDL_Savefile::Restore can be used to restore items for use within the current IDL session.

; Select a SAVE file to restore. The file contains volume data.

savefile = FILEPATH('cduskcD1400.sav', $

SUBDIRECTORY=['examples', 'data'])

; Create a savefile object.

sObj = OBJ_NEW('IDL_Savefile', savefile)

; Query the contents of the SAVE file to determine the number of

; regular variables contained therein.

sContents = sObj->Contents()

PRINT, sContents.N_VAR

; IDL Prints:

; 3

; Retrieve the names of the variables in the SAVE file.

sNames = sObj->Names()

PRINT, sNames

; IDL Prints:

; DENSITY MASSFLUX VELOCITY

; Determine the size of the DENSITY variable.

sDensitySize = sObj->Size('density')

PRINT, sDensitySize

; IDL Prints:

; 3 30 30 15 1 13500

; Restore the DENSITY variable.

sObj->Restore, 'density'

; Display the volume data.

IVOLUME, density

## Version History

6.1 | Introduced

## See Also

HEAP_NOSAVE, HEAP_SAVE, RESTORE, SAVE