1 | /* |
2 | |
3 | Derby - Class org.apache.derby.impl.io.DirRandomAccessFile |
4 | |
5 | Copyright 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.impl.io; |
22 | |
23 | import org.apache.derby.iapi.services.sanity.SanityManager; |
24 | |
25 | import org.apache.derby.io.StorageFile; |
26 | import org.apache.derby.io.StorageRandomAccessFile; |
27 | |
28 | import java.io.File; |
29 | import java.io.RandomAccessFile; |
30 | import java.io.IOException; |
31 | import java.io.FileNotFoundException; |
32 | |
33 | /** |
34 | * This class provides a disk based implementation of the StIRandomAccess File interface. It is used by the |
35 | * database engine to access persistent data and transaction logs under the directory (default) subsubprotocol. |
36 | */ |
37 | class DirRandomAccessFile extends RandomAccessFile implements StorageRandomAccessFile |
38 | { |
39 | |
40 | /** |
41 | * Construct a StorageRandomAccessFileImpl. |
42 | * |
43 | * @param name The file name. |
44 | * @param mode The file open mode: "r", "rw", "rws", or "rwd". The "rws" and "rwd" modes specify that the file is to |
45 | * be synchronized, consistent with the java.io.RandomAccessFile class. However the |
46 | * StorageRandomAccessFile.sync() method will be called even if the file was opened |
47 | * in "rws" or "rwd" mode. If the "rws" or "rwd" modes are supported then the implementation |
48 | * of StorageRandomAccessFile.sync need not do anything. |
49 | * |
50 | * @exception IllegalArgumentException if the mode argument is not equal to one of "r", "rw". |
51 | * @exception FileNotFoundException if the file exists but is a directory rather than a regular |
52 | * file, or cannot be opened or created for any other reason . |
53 | */ |
54 | DirRandomAccessFile( File name, String mode) throws FileNotFoundException |
55 | { |
56 | super( name, mode); |
57 | } |
58 | |
59 | /** |
60 | * Force any changes out to the persistent store. |
61 | * |
62 | * @param metaData If true then this method is required to force changes to both the file's |
63 | * content and metadata to be written to storage; otherwise, it need only force content changes |
64 | * to be written. |
65 | * |
66 | * @exception IOException If an IO error occurs. |
67 | */ |
68 | public void sync( boolean metaData) throws IOException |
69 | { |
70 | getFD().sync(); |
71 | } |
72 | } |
73 | |