Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Opening and closing a file

When a RandomAccessRecordFile object is constructed, the file specified as RecordFile object is opened in the specified mode with the specified access method or with the specified access parameters.

The file must already exist in the underlying file system and the access method must belong to this file system and must be permissible for this file. The user must possess the necessary access rights to the file for the specified open mode. If a Security Manager is active and its restrictions for this file conflict with the specified open mode, an exception is triggered (see section "Security").

If access parameters are specified for opening the file, these are taken into account when the file is opened provided the file parameters do not have priority. After the file has been opened, the parameters are updated with the corresponding values of the opened file.

The close() method closes the file. Subsequently no I/O operations can be performed via this RandomAccessRecordFile object.

Special features of the DMS file system

Shared update processing (see section "Shared update processing" and section "AccessParameter") for a RandomAccessRecordFile is possible with the UPAM access method only for PAM files in the INPUT and INOUT open modes. If the file was opened in INPUT open mode, all accesses are made without locks. Consequently, no access conflicts can arise. However, it must be expected that another application changes the contents of the record in the meantime. In the INOUT open mode, read and write accesses are made with an implicit lock. In the event of access conflicts the option set using setWaitMode() can trigger a RecordLockedException or cause the thread or the entire application to wait. Locks are implicitly released when the locked record is written but can also be explicitly released using flush(). Details are provided in the appropriate interface description in the shipped JAVADOC documentation.