Clobpublic class Clob extends Object implements Clob
This class is inherited from java.sql.Clob.
The Clob is used to store a CLOB as a column value in a row of a database table.
SystemCapability.Data#DATA_APPDATAMGR| 构造器 | 说明 |
|---|---|
Clob(String charData) |
A constructor used to create a
Clob object from data of the char type. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
equals(Object object) |
Indicates whether some other object is "equal to" this one.
|
void |
free() |
This method frees the
Clob object and releases the resources the resources
that it holds. |
InputStream |
getAsciiStream() |
Retrieves the
CLOB value designated by this Clob
object as an ascii stream. |
Reader |
getCharacterStream() |
Retrieves the
CLOB value designated by this Clob
object as a java.io.Reader object (or as a stream of
characters). |
Reader |
getCharacterStream(long pos,
long length) |
Returns a
Reader object that contains a partial Clob value, starting
with the character specified by pos, which is length characters in length. |
String |
getSubString(long startPos,
int length) |
Retrieves a copy of the specified substring
in the
CLOB value
designated by this Clob object. |
int |
hashCode() |
Returns a hash code value for the object.
|
long |
length() |
Retrieves the number of characters
in the
CLOB value
designated by this Clob object. |
long |
position(String stringToFind,
long startPos) |
Retrieves the character position at which the specified substring
searchstr appears in the SQL CLOB value
represented by this Clob object. |
long |
position(Clob clob,
long startPos) |
Retrieves the character position at which the specified
Clob object searchstr appears in this
Clob object. |
OutputStream |
setAsciiStream(long indexToWriteAt) |
Retrieves a stream to be used to write Ascii characters to the
CLOB value that this Clob object represents,
starting at position pos. |
Writer |
setCharacterStream(long indexToWriteAt) |
Retrieves a stream to be used to write a stream of Unicode characters
to the
CLOB value that this Clob object
represents, at position pos. |
int |
setString(long pos,
String str) |
Writes the given Java
String to the CLOB
value that this Clob object designates at the position
pos. |
int |
setString(long pos,
String str,
int offset,
int length) |
Writes
len characters of str, starting
at character offset, to the CLOB value
that this Clob represents. |
String |
toString() |
Returns a string representation of the object.
|
void |
truncate(long length) |
Truncates the
CLOB value that this Clob
designates to have a length of len
characters. |
public Clob(String charData)
Clob object from data of the char type.
CLOB is usually used to store text data.
charData - Indicates the data of the char type.public long length()
ClobCLOB value
designated by this Clob object.public String getSubString(long startPos, int length)
CLOB value
designated by this Clob object.
The substring begins at position
pos and has up to length consecutive
characters.getSubString 在接口中 ClobstartPos - Indicates the position of the first character of the string to extract.
The value ranges from 1 to 2147483648.length - the number of consecutive characters to be copied;
the value for length must be 0 or greaterString that is the specified substring in
the CLOB value designated by this Clob objectpublic Reader getCharacterStream()
ClobCLOB value designated by this Clob
object as a java.io.Reader object (or as a stream of
characters).getCharacterStream 在接口中 Clobjava.io.Reader object containing the
CLOB dataClob.setCharacterStream(long)public InputStream getAsciiStream()
ClobCLOB value designated by this Clob
object as an ascii stream.getAsciiStream 在接口中 Clobjava.io.InputStream object containing the
CLOB dataClob.setAsciiStream(long)public long position(String stringToFind, long startPos)
searchstr appears in the SQL CLOB value
represented by this Clob object. The search
begins at position start.public long position(Clob clob, long startPos)
Clob object searchstr appears in this
Clob object. The search begins at position
start.public int setString(long pos,
String str)
String to the CLOB
value that this Clob object designates at the position
pos. The string will overwrite the existing characters
in the Clob object starting at the position
pos. If the end of the Clob value is reached
while writing the given string, then the length of the Clob
value will be increased to accommodate the extra characters.
Note: If the value specified for pos
is greater then the length+1 of the CLOB value then the
behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this
operation.
public int setString(long pos,
String str,
int offset,
int length)
len characters of str, starting
at character offset, to the CLOB value
that this Clob represents. The string will overwrite the existing characters
in the Clob object starting at the position
pos. If the end of the Clob value is reached
while writing the given string, then the length of the Clob
value will be increased to accommodate the extra characters.
Note: If the value specified for pos
is greater then the length+1 of the CLOB value then the
behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this
operation.
setString 在接口中 Clobpos - Indicates the start position. The value ranges from 1 to 2147483648.str - the string to be written to the CLOB
value that this Clob object representsoffset - the offset into str to start reading
the characters to be writtenlength - the number of characters to be writtenpublic OutputStream setAsciiStream(long indexToWriteAt)
CLOB value that this Clob object represents,
starting at position pos. Characters written to the stream
will overwrite the existing characters
in the Clob object starting at the position
pos. If the end of the Clob value is reached
while writing characters to the stream, then the length of the Clob
value will be increased to accommodate the extra characters.
Note: If the value specified for pos
is greater then the length+1 of the CLOB value then the
behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this
operation.
setAsciiStream 在接口中 ClobindexToWriteAt - Indicates the position where to start writing ASCII characters to
this Clob instance. The value ranges from 1 to 2147483648.Clob.getAsciiStream()public Writer setCharacterStream(long indexToWriteAt)
CLOB value that this Clob object
represents, at position pos. Characters written to the stream
will overwrite the existing characters
in the Clob object starting at the position
pos. If the end of the Clob value is reached
while writing characters to the stream, then the length of the Clob
value will be increased to accommodate the extra characters.
Note: If the value specified for pos
is greater then the length+1 of the CLOB value then the
behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this
operation.
setCharacterStream 在接口中 ClobindexToWriteAt - Indicates the position where to start writing a stream of Unicode characters to
this Clob instance. The value ranges from 1 to 2147483648.Clob.getCharacterStream()public void truncate(long length)
ClobCLOB value that this Clob
designates to have a length of len
characters.
Note: If the value specified for pos
is greater then the length+1 of the CLOB value then the
behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this
operation.
public void free()
ClobClob object and releases the resources the resources
that it holds. The object is invalid once the free method
is called.
After free has been called, any attempt to invoke a
method other than free will result in a SQLException
being thrown. If free is called multiple times, the subsequent
calls to free are treated as a no-op.
public Reader getCharacterStream(long pos, long length)
ClobReader object that contains a partial Clob value, starting
with the character specified by pos, which is length characters in length.getCharacterStream 在接口中 Clobpos - the offset to the first character of the partial value to
be retrieved. The first character in the Clob is at position 1.length - the length in characters of the partial value to be retrieved.Reader through which the partial Clob value can be read.public boolean equals(Object object)
Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode method, which states
that equal objects must have equal hash codes.
equals 在类中 Objectobject - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())