AccessMode and CreationMode

The following table illustrates the behavior of DiskStorage::create/DiskStorageWithRollback::create of each AccessMode and CreationMode combination.

AccessModeCreationModeDescriptionWhen the file existsWhen the file not exist
accessReadcreationDefaultIdentical to openExistingOpen itFail
openExistingIf the file exists, opening it in read-only mode.
If the file does not exist, the function fails.
Open itFail
openAlwaysIf the file exists, opening it in read-only mode.
If the file does not exist, the function automatically create a new file and open it in read-only mode.
Open itCreate New
createNewIf the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in read-only mode.FailCreate New
createAlwaysThe function always create a new file and open it in read-only mode. (Not frequently used.)Truncate itCreate New
truncateExistingIf the file exists, the function removes all the content of it and opening it in read-only mode.
If the file does not exist, the function fails.
FailFail
accessWritecreationDefaultIdentical to createAlwaysTruncate itCreate New
openExistingIf the file exists, opening it in write-only mode.
If the file does not exist, the function fails.
Open it (to overwrite)Fail
openAlwaysIf the file exists, the function open it in write-only mode.
If the file does not exist, the function create a new file and open it in write-only mode.
Open it (to overwrite)Create New
createNewIf the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in write-only mode.FailCreate New
createAlwaysThe function always create a new file and open it in write-only mode.Truncate itCreate New
truncateExistingIf the file exists, the function removes all the content of it and opening it in write-only mode.
If the file does not exist, the function fails.
Truncate itFail
accessRWcreationDefaultIdentical to openAlwaysOpen it (to overwrite)Create New
openExistingIf the file exists, opening it in read-write mode.
If the file does not exist, the function fails.
Open it (to overwrite)Fail
openAlwaysIf the file exists, the function open it in read-write mode.
If the file does not exist, the function create a new file and open it in read-write mode.
Open it (to overwrite)Create New
createNewIf the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in read-write mode.FailCreate New
createAlwaysThe function always create a new file and open it in read-write mode.Truncate itCreate New
truncateExistingIf the file exists, the function removes all the content of it and opening it in read-write mode.
If the file does not exist, the function fails.
Truncate itFail

The terms used in 'When the file exists' and 'When the file not exist' are defined as follows:

FailThe function will fail with the specified parameter configuration.
Open itThe function will open the file.
Open it (to overwrite)The function will open the file to write on it.
Create NewThe function will create a new file.
Truncate itThe function will remove all the contents on the file and open it.
See Also
DiskStorage, StorageRollback, AccessMode, CreationMode

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo