Top Description Fields Constructors Methods
org.h2.jdbc

public final Class JdbcClob

extends JdbcLob
implements NClob
Class Inheritance
All Implemented Interfaces
java.sql.NClob, java.sql.Clob
Imports
java.io.InputStream, .OutputStream, .Reader, .StringReader, .StringWriter, .Writer, java.sql.Clob, .NClob, .SQLException, org.h2.engine.Constants, org.h2.message.DbException, .TraceObject, org.h2.store.RangeReader, org.h2.util.IOUtils, org.h2.value.Value

Represents a CLOB value.

Field Summary

Inherited from org.h2.jdbc.JdbcLob:
connstatevalue

Constructor Summary

AccessConstructor and Description
public
JdbcClob(JdbcConnection
it belongs to
conn
,
Value
of
value
,
JdbcLob.State
of the LOB
state
,
int
of the trace object
id
)

INTERNAL

Method Summary

Modifier and TypeMethod and Description
public InputStream

Returns:

the input stream
getAsciiStream
()

Implements java.sql.Clob.getAsciiStream.

Returns the input stream.

public Reader
getCharacterStream()

Overrides org.h2.jdbc.JdbcLob.getCharacterStream.

Implements java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

public Reader

Returns:

the reader
getCharacterStream
(long
1-based offset
pos
,
long
length of requested area
length
)

Implements java.sql.Clob.getCharacterStream.

Returns the reader, starting from an offset.

public String

Returns:

the string
getSubString
(long
the position (the first character is at position 1)
pos
,
int
the number of characters
length
)

Implements java.sql.Clob.getSubString.

Returns a substring.

public long

Returns:

the length
length
()

Implements java.sql.Clob.length.

Returns the length.

public long
position(String
the substring for which to search
pattern
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

[Not supported] Searches a pattern and return the position.

public long
position(Clob
the Clob object for which to search
clobPattern
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

[Not supported] Searches a pattern and return the position.

public OutputStream
setAsciiStream(long
the position at which to start writing to this CLOB object; The first position is 1
pos
)

Implements java.sql.Clob.setAsciiStream.

[Not supported] Returns an output stream.

public Writer

Returns:

a writer
setCharacterStream
(long
where to start writing (the first character is at position 1)
pos
)

Implements java.sql.Clob.setCharacterStream.

Get a writer to update the Clob.

public int

Returns:

the length of the added text
setString
(long
where to start writing (the first character is at position 1)
pos
,
String
the string to add
str
)

Implements java.sql.Clob.setString.

Fills the Clob.

public int

Returns:

the length of the added text
setString
(long
where to start writing (the first character is at position 1)
pos
,
String
the string to add
str
,
int
the string offset
offset
,
int
the number of characters to read
len
)

Implements java.sql.Clob.setString.

Fills the Clob.

public void
truncate(long
the length, in characters, to which the CLOB value should be truncated
len
)

Implements java.sql.Clob.truncate.

[Not supported] Truncates the object.

Inherited from org.h2.jdbc.JdbcLob:
checkClosedcheckEditablecheckReadablecompleteWritefreegetBinaryStreamsetCharacterStreamImplsetClobOutputStreamImpltoString

Constructor Detail

JdbcClobback to summary
public JdbcClob(JdbcConnection conn, Value value, JdbcLob.State state, int id)

INTERNAL

Parameters
conn:JdbcConnection

it belongs to

value:Value

of

state:JdbcLob.State

of the LOB

id:int

of the trace object

Method Detail

getAsciiStreamback to summary
public InputStream getAsciiStream() throws SQLException

Implements java.sql.Clob.getAsciiStream.

Returns the input stream.

Returns:InputStream

the input stream

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.getAsciiStream.

if there is an error accessing the CLOB value

getCharacterStreamback to summary
public Reader getCharacterStream() throws SQLException

Overrides org.h2.jdbc.JdbcLob.getCharacterStream.

Implements java.sql.Clob.getCharacterStream.

Doc from java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

Returns:Reader

a java.io.Reader object containing the CLOB data

Annotations
@Override
Exceptions
SQLException:
if there is an error accessing the CLOB value
getCharacterStreamback to summary
public Reader getCharacterStream(long pos, long length) throws SQLException

Implements java.sql.Clob.getCharacterStream.

Returns the reader, starting from an offset.

Parameters
pos:long

1-based offset

length:long

length of requested area

Returns:Reader

the reader

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.getCharacterStream.

if pos is less than 1; or if pos is greater than the number of characters in the Clob; or if pos + length is greater than the number of characters in the Clob

getSubStringback to summary
public String getSubString(long pos, int length) throws SQLException

Implements java.sql.Clob.getSubString.

Returns a substring.

Parameters
pos:long

the position (the first character is at position 1)

length:int

the number of characters

Returns:String

the string

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.getSubString.

if there is an error accessing the CLOB value; if pos is less than 1 or length is less than 0

lengthback to summary
public long length() throws SQLException

Implements java.sql.Clob.length.

Returns the length.

Returns:long

the length

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.length.

if there is an error accessing the length of the CLOB value

positionback to summary
public long position(String pattern, long start) throws SQLException

Implements java.sql.Clob.position.

[Not supported] Searches a pattern and return the position.

Parameters
pattern:String

Doc from java.sql.Clob.position.

the substring for which to search

start:long

Doc from java.sql.Clob.position.

the position at which to begin searching; the first position is 1

Returns:long

Doc from java.sql.Clob.position.

the position at which the substring appears or -1 if it is not present; the first position is 1

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.position.

if there is an error accessing the CLOB value or if pos is less than 1

positionback to summary
public long position(Clob clobPattern, long start) throws SQLException

Implements java.sql.Clob.position.

[Not supported] Searches a pattern and return the position.

Parameters
clobPattern:Clob

Doc from java.sql.Clob.position.

the Clob object for which to search

start:long

Doc from java.sql.Clob.position.

the position at which to begin searching; the first position is 1

Returns:long

Doc from java.sql.Clob.position.

the position at which the Clob object appears or -1 if it is not present; the first position is 1

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.position.

if there is an error accessing the CLOB value or if start is less than 1

setAsciiStreamback to summary
public OutputStream setAsciiStream(long pos) throws SQLException

Implements java.sql.Clob.setAsciiStream.

[Not supported] Returns an output stream.

Parameters
pos:long

Doc from java.sql.Clob.setAsciiStream.

the position at which to start writing to this CLOB object; The first position is 1

Returns:OutputStream

Doc from java.sql.Clob.setAsciiStream.

the stream to which ASCII encoded characters can be written

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.setAsciiStream.

if there is an error accessing the CLOB value or if pos is less than 1

setCharacterStreamback to summary
public Writer setCharacterStream(long pos) throws SQLException

Implements java.sql.Clob.setCharacterStream.

Get a writer to update the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The Clob is created in a separate thread, and the object is only updated when Writer.close() is called. The position must be 1, meaning the whole Clob data is set.

Parameters
pos:long

where to start writing (the first character is at position 1)

Returns:Writer

a writer

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.setCharacterStream.

if there is an error accessing the CLOB value or if pos is less than 1

setStringback to summary
public int setString(long pos, String str) throws SQLException

Implements java.sql.Clob.setString.

Fills the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The position must be 1, meaning the whole Clob data is set.

Parameters
pos:long

where to start writing (the first character is at position 1)

str:String

the string to add

Returns:int

the length of the added text

Annotations
@Override
Exceptions
SQLException:
on failure
setStringback to summary
public int setString(long pos, String str, int offset, int len) throws SQLException

Implements java.sql.Clob.setString.

Fills the Clob. This is only supported for new, empty Clob objects that were created with Connection.createClob() or createNClob(). The position must be 1, meaning the whole Clob data is set.

Parameters
pos:long

where to start writing (the first character is at position 1)

str:String

the string to add

offset:int

the string offset

len:int

the number of characters to read

Returns:int

the length of the added text

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.setString.

if there is an error accessing the CLOB value or if pos is less than 1

truncateback to summary
public void truncate(long len) throws SQLException

Implements java.sql.Clob.truncate.

[Not supported] Truncates the object.

Parameters
len:long

Doc from java.sql.Clob.truncate.

the length, in characters, to which the CLOB value should be truncated

Annotations
@Override
Exceptions
SQLException:

Doc from java.sql.Clob.truncate.

if there is an error accessing the CLOB value or if len is less than 0