KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > io > DirRandomAccessFile


1 /*
2
3    Derby - Class org.apache.derby.impl.io.DirRandomAccessFile
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.io;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25
26 import org.apache.derby.io.StorageFile;
27 import org.apache.derby.io.StorageRandomAccessFile;
28
29 import java.io.File JavaDoc;
30 import java.io.RandomAccessFile JavaDoc;
31 import java.io.IOException JavaDoc;
32 import java.io.FileNotFoundException JavaDoc;
33
34 /**
35  * This class provides a disk based implementation of the StIRandomAccess File interface. It is used by the
36  * database engine to access persistent data and transaction logs under the directory (default) subsubprotocol.
37  */

38 class DirRandomAccessFile extends RandomAccessFile implements StorageRandomAccessFile
39 {
40
41     /**
42      * Construct a StorageRandomAccessFileImpl.
43      *
44      * @param name The file name.
45      * @param mode The file open mode: "r", "rw", "rws", or "rwd". The "rws" and "rwd" modes specify that the file is to
46      * be synchronized, consistent with the java.io.RandomAccessFile class. However the
47      * StorageRandomAccessFile.sync() method will be called even if the file was opened
48      * in "rws" or "rwd" mode. If the "rws" or "rwd" modes are supported then the implementation
49      * of StorageRandomAccessFile.sync need not do anything.
50      *
51      * @exception IllegalArgumentException if the mode argument is not equal to one of "r", "rw".
52      * @exception FileNotFoundException if the file exists but is a directory rather than a regular
53      * file, or cannot be opened or created for any other reason .
54      */

55     DirRandomAccessFile( File name, String JavaDoc mode) throws FileNotFoundException JavaDoc
56     {
57         super( name, mode);
58     }
59
60     /**
61      * Force any changes out to the persistent store.
62      *
63      * @param metaData If true then this method is required to force changes to both the file's
64      * content and metadata to be written to storage; otherwise, it need only force content changes
65      * to be written.
66      *
67      * @exception IOException If an IO error occurs.
68      */

69     public void sync( boolean metaData) throws IOException JavaDoc
70     {
71         getFD().sync();
72     }
73 }
74     
75
Popular Tags