public abstract class StoragePolicy extends Object
Code which has no preferences about how to store data can obtain
 an instance of this class using the getDefaultPolicy() method.
 The initial value of this may be selected by setting the 
 system property named by the string PREF_PROPERTY
 ("startable.storage").
 You may also use the name of a class which extends StoragePolicy
 and has a no-arg constructor, in which case one of these will be
 instantiated and used.
 The default, if not otherwise set, corresponds to "adaptive".
 
Code which wants to store data in a particular way may use one of
 the predefined policies ADAPTIVE, PREFER_MEMORY,
 PREFER_DISK SIDEWAYS or DISCARD,
 or may implement their own policy by extending this class.
 If you want more control, you can always create instances of the 
 public RowStore implementations directly.
| Modifier and Type | Field and Description | 
|---|---|
| static StoragePolicy | ADAPTIVEStorage policy which will store small amounts of data in an array
 in memory, and larger amounts in a scratch disk file. | 
| static StoragePolicy | DISCARDStorage policy which just throws away the rows it is given. | 
| static String | PREF_PROPERTYName of the system property which can be set to indicate the
 initial setting of the default storage policy ("startable.storage"). | 
| static StoragePolicy | PREFER_DISKStorage policy which will normally store table data in a scratch
 disk file. | 
| static StoragePolicy | PREFER_MEMORYStorage policy which will always store table data in memory. | 
| static StoragePolicy | SIDEWAYSStorage policy which will normally store table data in scratch disk
 files in such a way that cells from the same column are contiguous
 on disk. | 
| Constructor and Description | 
|---|
| StoragePolicy() | 
| Modifier and Type | Method and Description | 
|---|---|
| StarTable | copyTable(StarTable table)Returns a random-access deep copy of the given table. | 
| static StoragePolicy | getDefaultPolicy()Returns the default storage policy for this JVM. | 
| abstract ByteStore | makeByteStore()Returns a new ByteStore object which can be used to
 provide a destination for general purpose data storage. | 
| abstract RowStore | makeConfiguredRowStore(StarTable meta)Creates a new RowStore and primes it by calling
  TableSink.acceptMetadata(uk.ac.starlink.table.StarTable)on it. | 
| abstract RowStore | makeRowStore()Returns a new  RowStoreobject which can be used to
 provide a destination for random-access table storage. | 
| StarTable | randomTable(StarTable table)Returns a table based on a given table and guaranteed to have
 random access. | 
| static void | setDefaultPolicy(StoragePolicy policy)Sets the default storage policy used for this JVM. | 
public static final String PREF_PROPERTY
public static final StoragePolicy PREFER_MEMORY
public static final StoragePolicy PREFER_DISK
java.io.tmpdir
 system property.  These files will be deleted when the JVM exits,
 if not before.  They will probably be deleted around the
 time they are no longer needed (when the RowStore in question is 
 garbage collected), though this cannot be guaranteed since it
 depends on the details of the JVM's GC implementation.public static final StoragePolicy SIDEWAYS
PREFER_DISK however, so it is only the best choice in
 rather specialised circumstances.
 If it's impossible for some reason to store the data in this way,
 or if the number of cells requested is small, it will fall back
 to using memory storage.
 Temporary disk files (at least one per column) are written 
 in the default temporary directory, which is the value of the 
 java.io.tmpdir system property.  
 These files will be deleted when the JVM exits,
 if not before.  They will probably be deleted around the
 time they are no longer needed (when the RowStore in question is 
 garbage collected), though this cannot be guaranteed since it
 depends on the details of the JVM's GC implementation.public static final StoragePolicy DISCARD
public static final StoragePolicy ADAPTIVE
java.io.tmpdir
 system property.  These files will be deleted when the JVM exits,
 if not before.  They will probably be deleted around the
 time they are no longer needed (when the RowStore in question is 
 garbage collected), though this cannot be guaranteed since it
 depends on the details of the JVM's GC implementation.public static StoragePolicy getDefaultPolicy()
public static void setDefaultPolicy(StoragePolicy policy)
policy - new default storage policypublic abstract ByteStore makeByteStore()
public abstract RowStore makeRowStore()
RowStore object which can be used to
 provide a destination for random-access table storage.public abstract RowStore makeConfiguredRowStore(StarTable meta)
TableSink.acceptMetadata(uk.ac.starlink.table.StarTable) on it.meta - template giving the metadata which describes the rows
          that will have to be storedacceptMetadata(meta) has been
          calledpublic StarTable randomTable(StarTable table) throws IOException
table has random
 access then it is returned, otherwise a new random access table
 is built using its data.table - original tabletable and with
          isRandom()==trueIOExceptionpublic StarTable copyTable(StarTable table) throws IOException
randomTable(uk.ac.starlink.table.StarTable) except 
 that a copy is made even if the original is already random access.
 It can be useful if you want a copy of the table known to have
 the resource usage or performance characteristics defined by 
 this policy.table - input tabletableIOExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.