-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathClob.java
More file actions
194 lines (178 loc) · 7.03 KB
/
Copy pathClob.java
File metadata and controls
194 lines (178 loc) · 7.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.sql;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
/**
* A Java interface mapping for the SQL CLOB type.
* <p>
* An SQL {@code CLOB} type stores a large array of characters as the value in a
* column of a database.
* <p>
* The {@code java.sql.Clob} interface provides methods for setting and
* retrieving data in the {@code Clob}, for querying {@code Clob} data length,
* for searching for data within the {@code Clob}.
*/
public interface Clob {
/**
* Gets the value of this {@code Clob} object as an ASCII stream.
*
* @return an ASCII {@code InputStream} giving access to the
* {@code Clob} data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public InputStream getAsciiStream() throws SQLException;
/**
* Gets the data of this {@code Clob} object in a {@code java.io.Reader}.
*
* @return a character stream Reader object giving access to the {@code
* Clob} data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public Reader getCharacterStream() throws SQLException;
/**
* Gets a copy of a specified substring in this {@code Clob}.
*
* @param pos
* the index of the start of the substring in the {@code Clob}.
* @param length
* the length of the data to retrieve.
* @return A string containing the requested data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public String getSubString(long pos, int length) throws SQLException;
/**
* Retrieves the number of characters in this {@code Clob} object.
*
* @return a long value with the number of character in this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public long length() throws SQLException;
/**
* Retrieves the character position at which a specified {@code Clob} object
* appears in this {@code Clob} object.
*
* @param searchstr
* the specified {@code Clob} to search for.
* @param start
* the position within this {@code Clob} to start the search
* @return a long value with the position at which the specified {@code
* Clob} occurs within this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public long position(Clob searchstr, long start) throws SQLException;
/**
* Retrieves the character position at which a specified substring appears
* in this {@code Clob} object.
*
* @param searchstr
* the string to search for.
* @param start
* the position at which to start the search within this {@code
* Clob}.
* @return a long value with the position at which the specified string
* occurs within this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public long position(String searchstr, long start) throws SQLException;
/**
* Retrieves a stream which can be used to write Ascii characters to this
* {@code Clob} object, starting at specified position.
*
* @param pos
* the position at which to start the writing.
* @return an OutputStream which can be used to write ASCII characters to
* this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public OutputStream setAsciiStream(long pos) throws SQLException;
/**
* Retrieves a stream which can be used to write a stream of unicode
* characters to this {@code Clob} object, at a specified position.
*
* @param pos
* the position at which to start the writing.
* @return a Writer which can be used to write unicode characters to this
* {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public Writer setCharacterStream(long pos) throws SQLException;
/**
* Writes a given Java String to this {@code Clob} object at a specified
* position.
*
* @param pos
* the position at which to start the writing.
* @param str
* the string to write.
* @return the number of characters written.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public int setString(long pos, String str) throws SQLException;
/**
* Writes {@code len} characters of a string, starting at a specified
* character offset, to this {@code Clob}.
*
* @param pos
* the position at which to start the writing.
* @param str
* the String to write.
* @param offset
* the offset within {@code str} to start writing from.
* @param len
* the number of characters to write.
* @return the number of characters written.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public int setString(long pos, String str, int offset, int len)
throws SQLException;
/**
* Truncates this {@code Clob} after the specified number of characters.
*
* @param len
* the length in characters giving the place to
* truncate this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
*/
public void truncate(long len) throws SQLException;
/**
* Frees any resources held by this clob. After {@code free} is called, calling
* method other than {@code free} will throw {@code SQLException} (calling {@code free}
* repeatedly will do nothing).
*
* @throws SQLException
*/
public void free() throws SQLException;
/**
* Returns a {@link Reader} that reads {@code length} characters from this clob, starting
* at 1-based offset {code pos}.
*/
public Reader getCharacterStream(long pos, long length) throws SQLException;
}