KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > support > lob > AbstractLobHandler


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.jdbc.support.lob;
18
19 import java.io.InputStream JavaDoc;
20 import java.io.Reader JavaDoc;
21 import java.sql.ResultSet JavaDoc;
22 import java.sql.SQLException JavaDoc;
23
24 /**
25  * Abstract base class for LobHandler implementations.
26  *
27  * <p>Implements all accessor methods for column names through a column lookup
28  * and delegating to the corresponding accessor that takes a column index.
29  *
30  * @author Juergen Hoeller
31  * @since 1.2
32  * @see java.sql.ResultSet#findColumn
33  */

34 public abstract class AbstractLobHandler implements LobHandler {
35
36     public byte[] getBlobAsBytes(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc {
37         return getBlobAsBytes(rs, rs.findColumn(columnName));
38     }
39
40     public InputStream JavaDoc getBlobAsBinaryStream(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc {
41         return getBlobAsBinaryStream(rs, rs.findColumn(columnName));
42     }
43
44     public String JavaDoc getClobAsString(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc {
45         return getClobAsString(rs, rs.findColumn(columnName));
46     }
47
48     public InputStream JavaDoc getClobAsAsciiStream(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc {
49         return getClobAsAsciiStream(rs, rs.findColumn(columnName));
50     }
51
52     public Reader JavaDoc getClobAsCharacterStream(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc {
53         return getClobAsCharacterStream(rs, rs.findColumn(columnName));
54     }
55
56 }
57
Popular Tags