Package org.mariadb.jdbc
Class MariaDbClob
- java.lang.Object
-
- org.mariadb.jdbc.MariaDbBlob
-
- org.mariadb.jdbc.MariaDbClob
-
- All Implemented Interfaces:
java.io.Serializable
,java.sql.Blob
,java.sql.Clob
,java.sql.NClob
public class MariaDbClob extends MariaDbBlob implements java.sql.Clob, java.sql.NClob, java.io.Serializable
MariaDB Clob implementation- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.mariadb.jdbc.MariaDbBlob
MariaDbBlob.BlobOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class org.mariadb.jdbc.MariaDbBlob
data, length, offset
-
-
Constructor Summary
Constructors Constructor Description MariaDbClob()
Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.io.InputStream
getAsciiStream()
java.io.Reader
getCharacterStream()
java.io.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.java.lang.String
getSubString(long pos, int length)
Get sub string.long
length()
Return character length of the Clob.long
position(java.lang.String searchStr, long start)
long
position(java.sql.Clob searchStr, long start)
java.io.OutputStream
setAsciiStream(long pos)
java.io.Writer
setCharacterStream(long pos)
Set character stream.int
setString(long pos, java.lang.String str)
Set String.int
setString(long pos, java.lang.String str, int offset, int len)
java.lang.String
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, hashCode, position, position, safeMariaDbBlob, setBinaryStream, setBytes, setBytes
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
toString
public java.lang.String toString()
ToString implementation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- string value of blob content.
-
getSubString
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLException
Get sub string.- Specified by:
getSubString
in interfacejava.sql.Clob
- Parameters:
pos
- positionlength
- length of sub string- Returns:
- substring
- Throws:
java.sql.SQLException
- if pos is less than 1 or length is less than 0
-
getCharacterStream
public java.io.Reader getCharacterStream()
- Specified by:
getCharacterStream
in interfacejava.sql.Clob
-
getCharacterStream
public java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLException
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 interfacejava.sql.Clob
- 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:
java.sql.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
public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException
Set character stream.- Specified by:
setCharacterStream
in interfacejava.sql.Clob
- Parameters:
pos
- position- Returns:
- writer
- Throws:
java.sql.SQLException
- if position is invalid
-
getAsciiStream
public java.io.InputStream getAsciiStream() throws java.sql.SQLException
- Specified by:
getAsciiStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
position
public long position(java.lang.String searchStr, long start)
- Specified by:
position
in interfacejava.sql.Clob
-
position
public long position(java.sql.Clob searchStr, long start)
- Specified by:
position
in interfacejava.sql.Clob
-
utf8Position
private int utf8Position(int charPosition)
Convert character position into byte position in UTF8 byte array.- Parameters:
charPosition
- charPosition- Returns:
- byte position
-
setString
public int setString(long pos, java.lang.String str) throws java.sql.SQLException
Set String.- Specified by:
setString
in interfacejava.sql.Clob
- Parameters:
pos
- positionstr
- string- Returns:
- string length
- Throws:
java.sql.SQLException
- if UTF-8 conversion failed
-
setString
public int setString(long pos, java.lang.String str, int offset, int len) throws java.sql.SQLException
- Specified by:
setString
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
setAsciiStream
public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException
- Specified by:
setAsciiStream
in interfacejava.sql.Clob
- Throws:
java.sql.SQLException
-
length
public long length()
Return character length of the Clob. Assume UTF8 encoding.- Specified by:
length
in interfacejava.sql.Blob
- Specified by:
length
in interfacejava.sql.Clob
- Overrides:
length
in classMariaDbBlob
- Returns:
- length of the
BLOB
in bytes
-
truncate
public void truncate(long truncateLen)
Description copied from class:MariaDbBlob
Truncates theBLOB
value that thisBlob
object represents to belen
bytes in length.- Specified by:
truncate
in interfacejava.sql.Blob
- Specified by:
truncate
in interfacejava.sql.Clob
- Overrides:
truncate
in classMariaDbBlob
- Parameters:
truncateLen
- the length, in bytes, to which theBLOB
value that thisBlob
object represents should be truncated
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classMariaDbBlob
-
-