svn-gvsig-desktop / tags / v1_0_2_Build_898 / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / data / driver / FileDriver.java @ 10513
History | View | Annotate | Download (1.97 KB)
1 |
package com.hardcode.gdbms.engine.data.driver; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.IOException; |
5 |
|
6 |
import com.hardcode.driverManager.Driver; |
7 |
import com.hardcode.gdbms.engine.data.file.FileDataWare; |
8 |
|
9 |
|
10 |
/**
|
11 |
* Interface to the files.
|
12 |
*/
|
13 |
public interface FileDriver extends ReadAccess, GDBMSDriver { |
14 |
/**
|
15 |
* M?todo invocado al comienzo para abrir el fichero. A partir de la
|
16 |
* invocaci?n de este m?todo todos las operaciones se har?n sobre el File
|
17 |
* que se pasa como par?metro
|
18 |
*
|
19 |
* @param file Fichero que se debe de abrir
|
20 |
*
|
21 |
* @throws IOException Si se produce algun error
|
22 |
*/
|
23 |
void open(File file) throws IOException; |
24 |
|
25 |
/**
|
26 |
* Cierra el Fichero sobre el que se estaba accediendo
|
27 |
*
|
28 |
* @throws IOException Si se produce alg?n error
|
29 |
*/
|
30 |
void close() throws IOException; |
31 |
|
32 |
/**
|
33 |
* devuelve true si el driver puede leer el fichero que se pasa como
|
34 |
* par?metro, false en caso contrario
|
35 |
*
|
36 |
* @param f Fichero que se quiere comprobar
|
37 |
*
|
38 |
* @return DOCUMENT ME!
|
39 |
*/
|
40 |
boolean fileAccepted(File f); |
41 |
|
42 |
/**
|
43 |
* Writes the content in the DataWare to the last opened file (method open).
|
44 |
* The data must be written to a buffer (memory or disk) and then copied
|
45 |
* to the file because if the file is modified the dataWare data may be
|
46 |
* corrupted. A temporary file can be obtained from the DataSourceFactory
|
47 |
* passed to the setDataSourceFactory method to delegate clean tasks to the
|
48 |
* system
|
49 |
*
|
50 |
* @param dataWare DataWare with the contents
|
51 |
*/
|
52 |
void writeFile(FileDataWare dataWare) throws DriverException; |
53 |
|
54 |
/**
|
55 |
* Creates a new file with the given field names and types
|
56 |
*
|
57 |
* @param path Path to the new file
|
58 |
* @param fieldNames Names of the fields
|
59 |
* @param fieldTypes Types of the fields
|
60 |
*
|
61 |
* @throws IOException if the source cannot be created
|
62 |
*/
|
63 |
void createSource(String path, String[] fieldNames, int[] fieldTypes) throws IOException; |
64 |
} |