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 longserialVersionUID-
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 booleanequals(java.lang.Object o)java.io.InputStreamgetAsciiStream()java.io.ReadergetCharacterStream()java.io.ReadergetCharacterStream(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.StringgetSubString(long pos, int length)Get sub string.longlength()Return character length of the Clob.longposition(java.lang.String searchStr, long start)longposition(java.sql.Clob searchStr, long start)java.io.OutputStreamsetAsciiStream(long pos)java.io.WritersetCharacterStream(long pos)Set character stream.intsetString(long pos, java.lang.String str)Set String.intsetString(long pos, java.lang.String str, int offset, int len)java.lang.StringtoString()ToString implementation.voidtruncate(long truncateLen)Truncates theBLOBvalue that thisBlobobject represents to belenbytes in length.private intutf8Position(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:
toStringin classjava.lang.Object- Returns:
- string value of blob content.
-
getSubString
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLExceptionGet sub string.- Specified by:
getSubStringin 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:
getCharacterStreamin interfacejava.sql.Clob
-
getCharacterStream
public java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLExceptionReturns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.- Specified by:
getCharacterStreamin 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.SQLExceptionSet character stream.- Specified by:
setCharacterStreamin 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:
getAsciiStreamin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
position
public long position(java.lang.String searchStr, long start)- Specified by:
positionin interfacejava.sql.Clob
-
position
public long position(java.sql.Clob searchStr, long start)- Specified by:
positionin 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.SQLExceptionSet String.- Specified by:
setStringin 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:
setStringin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
setAsciiStream
public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
length
public long length()
Return character length of the Clob. Assume UTF8 encoding.- Specified by:
lengthin interfacejava.sql.Blob- Specified by:
lengthin interfacejava.sql.Clob- Overrides:
lengthin classMariaDbBlob- Returns:
- length of the
BLOBin bytes
-
truncate
public void truncate(long truncateLen)
Description copied from class:MariaDbBlobTruncates theBLOBvalue that thisBlobobject represents to belenbytes in length.- Specified by:
truncatein interfacejava.sql.Blob- Specified by:
truncatein interfacejava.sql.Clob- Overrides:
truncatein classMariaDbBlob- Parameters:
truncateLen- the length, in bytes, to which theBLOBvalue that thisBlobobject represents should be truncated
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classMariaDbBlob
-
-