public class IntDataStorageBuilder extends Object implements DataStorageBuilder
int
data type.IntMemoryDataStorage
,
IntDiskDataStorage
Constructor and Description |
---|
IntDataStorageBuilder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
DataStorage |
createCachedDataStorage(long size)
Get a data storage that is cached in memory, if possible, for the requested size of data.
|
DataStorage |
createDataStorage(DataStorage dataStorage)
Convert cached data storage to the appropriate normal data storage type.
|
DataStorage |
createDataStorage(long size)
Get an appropriate type of data storage for the requested size of data.
|
public DataStorage createDataStorage(long size) throws ApfloatRuntimeException
DataStorageBuilder
Note that the returned data storage object is not set to have the
requested size, so the client should call the object's DataStorage.setSize(long)
method before storing data to it.
createDataStorage
in interface DataStorageBuilder
size
- The size of data to be stored in the storage, in bytes.DataStorage
object of an appropriate type for storing size
bytes of data.ApfloatRuntimeException
public DataStorage createCachedDataStorage(long size) throws ApfloatRuntimeException
DataStorageBuilder
Note that the returned data storage object is not set to have the
requested size, so the client should call the object's DataStorage.setSize(long)
method before storing data to it.
createCachedDataStorage
in interface DataStorageBuilder
size
- The size of data to be stored in the storage, in bytes.DataStorage
object of an appropriate type for storing size
bytes of data, cached if possible.ApfloatRuntimeException
public DataStorage createDataStorage(DataStorage dataStorage) throws ApfloatRuntimeException
DataStorageBuilder
If the data storage already has the appropriate type for its size, the data
storage may be returned unchanged. The argument data storage does not necessarily
have to be created with the DataStorageBuilder.createCachedDataStorage(long)
method, it can
be created as well with the DataStorageBuilder.createDataStorage(long)
method.
If the given data storage does not have the appropriate type for its size, then a new data storage of the appropriate type is created and the data is copied to it.
createDataStorage
in interface DataStorageBuilder
dataStorage
- The data storage to be converted, if necessary.DataStorage
that can be the original data storage or a copy of it, with the appropriate type.ApfloatRuntimeException