KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > hajdbc > sql > FileSupport


1 /*
2  * HA-JDBC: High-Availability JDBC
3  * Copyright (c) 2004-2006 Paul Ferraro
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: ferraro@users.sourceforge.net
20  */

21 package net.sf.hajdbc.sql;
22
23 import java.io.File JavaDoc;
24 import java.io.InputStream JavaDoc;
25 import java.io.Reader JavaDoc;
26 import java.sql.Blob JavaDoc;
27 import java.sql.Clob JavaDoc;
28 import java.sql.SQLException JavaDoc;
29
30 /**
31  * Provides temp file support for serializing data for large objects and streams.
32  * Any files created by this object are deleted when {@link #close()} is called.
33  *
34  * @author Paul Ferraro
35  * @version $Revision: 1001 $
36  * @since 1.0
37  */

38 public interface FileSupport
39 {
40     /**
41      * Create a file from the specified binary input stream.
42      * @param inputStream a binary stream of data
43      * @return a temporary file
44      * @throws java.sql.SQLException if an IO error occurs
45      */

46     public File JavaDoc createFile(InputStream JavaDoc inputStream) throws SQLException JavaDoc;
47     
48     /**
49      * Create a file from the specified character input stream
50      * @param reader a character stream of data
51      * @return a temporary file
52      * @throws java.sql.SQLException if an IO error occurs
53      */

54     public File JavaDoc createFile(Reader JavaDoc reader) throws SQLException JavaDoc;
55
56     /**
57      * Create a file from the specified Blob.
58      * @param blob a binary large object
59      * @return a temporary file
60      * @throws java.sql.SQLException if an IO error occurs
61      */

62     public File JavaDoc createFile(Blob JavaDoc blob) throws SQLException JavaDoc;
63     
64     /**
65      * Create a file from the specified Clob.
66      * @param clob a character large object
67      * @return a temporary file
68      * @throws java.sql.SQLException if an IO error occurs
69      */

70     public File JavaDoc createFile(Clob JavaDoc clob) throws SQLException JavaDoc;
71     
72     /**
73      * Returns a reader for the specified file.
74      * @param file a temp file
75      * @return a reader
76      * @throws java.sql.SQLException if IO error occurs
77      */

78     public Reader JavaDoc getReader(File JavaDoc file) throws SQLException JavaDoc;
79     
80     /**
81      * Returns an input stream for the specified file.
82      * @param file a temp file
83      * @return an input stream
84      * @throws java.sql.SQLException if IO error occurs
85      */

86     public InputStream JavaDoc getInputStream(File JavaDoc file) throws SQLException JavaDoc;
87     
88     /**
89      * Returns an Blob that reads from the specified file.
90      * @param file a temp file
91      * @return a Blob object
92      * @throws java.sql.SQLException if IO error occurs
93      */

94     public Blob JavaDoc getBlob(File JavaDoc file) throws SQLException JavaDoc;
95     
96     /**
97      * Returns an Clob that reads from the specified file.
98      * @param file a temp file
99      * @return a Clob object
100      * @throws java.sql.SQLException if IO error occurs
101      */

102     public Clob JavaDoc getClob(File JavaDoc file) throws SQLException JavaDoc;
103     
104     /**
105      * Deletes any files created by this object.
106      */

107     public void close();
108 }
109
Popular Tags