01: /*-------------------------------------------------------------------------
02: *
03: * Copyright (c) 2004-2005, PostgreSQL Global Development Group
04: *
05: * IDENTIFICATION
06: * $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java,v 1.12 2007/03/29 06:13:53 jurka Exp $
07: *
08: *-------------------------------------------------------------------------
09: */
10: package org.postgresql.jdbc2;
11:
12: import org.postgresql.core.BaseConnection;
13: import java.io.InputStream;
14: import java.io.InputStreamReader;
15: import java.io.Reader;
16: import java.sql.Clob;
17: import java.sql.SQLException;
18:
19: public class AbstractJdbc2Clob extends AbstractJdbc2BlobClob {
20:
21: public AbstractJdbc2Clob(BaseConnection conn, long oid)
22: throws SQLException {
23: super (conn, oid);
24: }
25:
26: public synchronized InputStream getAsciiStream()
27: throws SQLException {
28: return getBinaryStream();
29: }
30:
31: public synchronized Reader getCharacterStream() throws SQLException {
32: return new InputStreamReader(getBinaryStream());
33: }
34:
35: public synchronized String getSubString(long i, int j)
36: throws SQLException {
37: assertPosition(i, j);
38: lo.seek((int) i - 1);
39: return new String(lo.read(j));
40: }
41:
42: /*
43: * For now, this is not implemented.
44: */
45: public synchronized long position(String pattern, long start)
46: throws SQLException {
47: checkFreed();
48: throw org.postgresql.Driver.notImplemented(this .getClass(),
49: "position(String,long)");
50: }
51:
52: /*
53: * This should be simply passing the byte value of the pattern Blob
54: */
55: public synchronized long position(Clob pattern, long start)
56: throws SQLException {
57: checkFreed();
58: throw org.postgresql.Driver.notImplemented(this .getClass(),
59: "position(Clob,start)");
60: }
61:
62: }
|