Package org.mariadb.jdbc
Class MariaDbClob
java.lang.Object
org.mariadb.jdbc.MariaDbBlob
org.mariadb.jdbc.MariaDbClob
- All Implemented Interfaces:
Serializable
,Blob
,Clob
,NClob
- See Also:
-
Field Summary
FieldsFields inherited from class org.mariadb.jdbc.MariaDbBlob
data, length, offset
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty Clob.MariaDbClob
(byte[] bytes) Creates a Clob with content.MariaDbClob
(byte[] bytes, int offset, int length) Creates a Clob with content. -
Method Summary
Modifier and TypeMethodDescriptiongetCharacterStream
(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.getSubString
(long pos, int length) Get sub string.long
length()
Return character length of the Clob.long
long
setAsciiStream
(long pos) setCharacterStream
(long pos) Set character stream.int
Set String.int
toString()
ToString implementation.void
truncate
(long truncateLen) Truncates theBLOB
value that thisBlob
object represents to belen
bytes in length.private int
utf8Position
(int charPosition) Convert character position into byte position in UTF8 byte array.Methods inherited from class org.mariadb.jdbc.MariaDbBlob
free, getBinaryStream, getBinaryStream, getBytes, position, position, setBinaryStream, setBytes, setBytes
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
MariaDbClob
public MariaDbClob(byte[] bytes) Creates a Clob with content.- Parameters:
bytes
- the content for the Clob.
-
MariaDbClob
public MariaDbClob(byte[] bytes, int offset, int length) Creates a Clob with content.- Parameters:
bytes
- the content for the Clob.offset
- offsetlength
- length
-
MariaDbClob
public MariaDbClob()Creates an empty Clob.
-
-
Method Details
-
toString
ToString implementation. -
getSubString
Get sub string.- Specified by:
getSubString
in interfaceClob
- Parameters:
pos
- positionlength
- length of sub string- Returns:
- substring
- Throws:
SQLException
- if pos is less than 1 or length is less than 0
-
getCharacterStream
- Specified by:
getCharacterStream
in interfaceClob
-
getCharacterStream
Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.- Specified by:
getCharacterStream
in interfaceClob
- Parameters:
pos
- 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.- Returns:
- Reader through which the partial Clob value can be read.
- Throws:
SQLException
- 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
-
setCharacterStream
Set character stream.- Specified by:
setCharacterStream
in interfaceClob
- Parameters:
pos
- position- Returns:
- writer
- Throws:
SQLException
- if position is invalid
-
getAsciiStream
- Specified by:
getAsciiStream
in interfaceClob
- Throws:
SQLException
-
position
-
position
-
utf8Position
private int utf8Position(int charPosition) Convert character position into byte position in UTF8 byte array.- Parameters:
charPosition
- charPosition- Returns:
- byte position
-
setString
Set String.- Specified by:
setString
in interfaceClob
- Parameters:
pos
- positionstr
- string- Returns:
- string length
- Throws:
SQLException
- if UTF-8 conversion failed
-
setString
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
setAsciiStream
- Specified by:
setAsciiStream
in interfaceClob
- Throws:
SQLException
-
length
public long length()Return character length of the Clob. Assume UTF8 encoding. -
truncate
public void truncate(long truncateLen) Description copied from class:MariaDbBlob
Truncates theBLOB
value that thisBlob
object represents to belen
bytes in length.
-