| 1 | /* Clob.java -- Access Character Large OBjects
|
|---|
| 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU General Public License as published by
|
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | any later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 19 | 02111-1307 USA.
|
|---|
| 20 |
|
|---|
| 21 | Linking this library statically or dynamically with other modules is
|
|---|
| 22 | making a combined work based on this library. Thus, the terms and
|
|---|
| 23 | conditions of the GNU General Public License cover the whole
|
|---|
| 24 | combination.
|
|---|
| 25 |
|
|---|
| 26 | As a special exception, the copyright holders of this library give you
|
|---|
| 27 | permission to link this library with independent modules to produce an
|
|---|
| 28 | executable, regardless of the license terms of these independent
|
|---|
| 29 | modules, and to copy and distribute the resulting executable under
|
|---|
| 30 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 31 | independent module, the terms and conditions of the license of that
|
|---|
| 32 | module. An independent module is a module which is not derived from
|
|---|
| 33 | or based on this library. If you modify this library, you may extend
|
|---|
| 34 | this exception to your version of the library, but you are not
|
|---|
| 35 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 36 | exception statement from your version. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package java.sql;
|
|---|
| 40 |
|
|---|
| 41 | import java.io.InputStream;
|
|---|
| 42 | import java.io.Reader;
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * This interface contains methods for accessing a SQL CLOB (Character
|
|---|
| 46 | * Large OBject) type.
|
|---|
| 47 | *
|
|---|
| 48 | * @author Aaron M. Renn ([email protected])
|
|---|
| 49 | */
|
|---|
| 50 | public interface Clob
|
|---|
| 51 | {
|
|---|
| 52 |
|
|---|
| 53 | /**
|
|---|
| 54 | * This method returns the number of characters in the CLOB.
|
|---|
| 55 | *
|
|---|
| 56 | * @return The number of characters in the CLOB.
|
|---|
| 57 | *
|
|---|
| 58 | * @exception SQLException If an error occurs.
|
|---|
| 59 | */
|
|---|
| 60 | public abstract long
|
|---|
| 61 | length() throws SQLException;
|
|---|
| 62 |
|
|---|
| 63 | /*************************************************************************/
|
|---|
| 64 |
|
|---|
| 65 | /**
|
|---|
| 66 | * This method returns the specified portion of the CLOB as a
|
|---|
| 67 | * <code>String</code>.
|
|---|
| 68 | *
|
|---|
| 69 | * @param offset The index into the CLOB (index values start at 1) to
|
|---|
| 70 | * start returning characters from.
|
|---|
| 71 | * @param length The requested number of characters to return.
|
|---|
| 72 | *
|
|---|
| 73 | * @return The requested CLOB section, as a <code>String</code>.
|
|---|
| 74 | *
|
|---|
| 75 | * @exception SQLException If an error occurs.
|
|---|
| 76 | */
|
|---|
| 77 | public abstract String
|
|---|
| 78 | getSubString(long offset, int length) throws SQLException;
|
|---|
| 79 |
|
|---|
| 80 | /*************************************************************************/
|
|---|
| 81 |
|
|---|
| 82 | /**
|
|---|
| 83 | * This method returns a byte stream that reads the contents of the
|
|---|
| 84 | * CLOB as a series of ASCII bytes.
|
|---|
| 85 | *
|
|---|
| 86 | * @return A stream to read the CLOB's contents.
|
|---|
| 87 | *
|
|---|
| 88 | * @exception SQLException If an error occurs.
|
|---|
| 89 | */
|
|---|
| 90 | public abstract InputStream
|
|---|
| 91 | getAsciiStream() throws SQLException;
|
|---|
| 92 |
|
|---|
| 93 | /*************************************************************************/
|
|---|
| 94 |
|
|---|
| 95 | /**
|
|---|
| 96 | * This method returns a character stream that reads the contents of the
|
|---|
| 97 | * CLOB.
|
|---|
| 98 | *
|
|---|
| 99 | * @return A character stream to read the CLOB's contents.
|
|---|
| 100 | *
|
|---|
| 101 | * @exception SQLException If an error occurs.
|
|---|
| 102 | */
|
|---|
| 103 | public abstract Reader
|
|---|
| 104 | getCharacterStream() throws SQLException;
|
|---|
| 105 |
|
|---|
| 106 | /*************************************************************************/
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | * This method returns the index into the CLOB of the first occurrence of
|
|---|
| 110 | * the specified character pattern (supplied by the caller as a
|
|---|
| 111 | * <code>String</code>). The search begins at the specified index.
|
|---|
| 112 | *
|
|---|
| 113 | * @param pattern The character pattern to search for, passed as a
|
|---|
| 114 | * <code>String</code>.
|
|---|
| 115 | * @param offset. The index into the CLOB to start search (indexes start
|
|---|
| 116 | * at 1).
|
|---|
| 117 | *
|
|---|
| 118 | * @return The index at which the pattern was found (indexes start at 1),
|
|---|
| 119 | * or -1 if the pattern was not found.
|
|---|
| 120 | *
|
|---|
| 121 | * @exception SQLException If an error occurs.
|
|---|
| 122 | */
|
|---|
| 123 | public abstract long
|
|---|
| 124 | position(String pattern, long offset) throws SQLException;
|
|---|
| 125 |
|
|---|
| 126 | /*************************************************************************/
|
|---|
| 127 |
|
|---|
| 128 | /**
|
|---|
| 129 | * This method returns the index into the CLOB of the first occurrence of
|
|---|
| 130 | * the specified character pattern (supplied by the caller as a
|
|---|
| 131 | * <code>Clob</code>). The search begins at the specified index.
|
|---|
| 132 | *
|
|---|
| 133 | * @param pattern The character pattern to search for, passed as a
|
|---|
| 134 | * <code>Clob</code>.
|
|---|
| 135 | * @param offset. The index into the CLOB to start search (indexes start
|
|---|
| 136 | * at 1).
|
|---|
| 137 | *
|
|---|
| 138 | * @return The index at which the pattern was found (indexes start at 1),
|
|---|
| 139 | * or -1 if the pattern was not found.
|
|---|
| 140 | *
|
|---|
| 141 | * @exception SQLException If an error occurs.
|
|---|
| 142 | */
|
|---|
| 143 | public abstract long
|
|---|
| 144 | position(Clob pattern, long offset) throws SQLException;
|
|---|
| 145 |
|
|---|
| 146 | } // interface Clob
|
|---|
| 147 |
|
|---|