org.apache.derby.client.am
Class ClientClob
- java.lang.Object
-
- org.apache.derby.client.am.Lob
-
- org.apache.derby.client.am.ClientClob
-
- All Implemented Interfaces:
- java.sql.Clob, UnitOfWorkListener
public class ClientClob extends Lob implements java.sql.Clob
This class implements the JDBCjava.sql.Clobinterface.
-
-
Field Summary
-
Fields inherited from class org.apache.derby.client.am.Lob
INVALID_LOCATOR
-
-
Constructor Summary
Constructors Constructor and Description ClientClob(Agent agent, byte[] unconvertedBytes, java.nio.charset.Charset charset, int dataOffset)ClientClob(Agent agent, java.io.InputStream inputStream, java.nio.charset.Charset encoding, int length)ClientClob(Agent agent, int locator)Create aClientClobobject for a Clob value stored on the server and indentified bylocator.ClientClob(Agent agent, java.lang.String string)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidfree()This method frees theClobobject and releases the resources the resources that it holds.java.io.InputStreamgetAsciiStream()java.io.ReadergetCharacterStream()java.io.ReadergetCharacterStream(long pos, long length)Returns aReaderobject that contains a partialClobvalue, starting with the character specified by pos, which is length characters in length.java.lang.StringgetString()java.lang.StringgetSubString(long pos, int length)Returns a copy of the specified substring in theCLOBvalue designated by thisClientClobobject.java.io.InputStreamgetUnicodeStream()intgetUTF8Length()byte[]getUtf8String()booleanisAsciiStream()booleanisCharacterStream()booleanisString()booleanisUnicodeStream()longlength()longposition(java.sql.Clob searchstr, long start)longposition(java.lang.String searchstr, long start)java.io.OutputStreamsetAsciiStream(long pos)java.io.WritersetCharacterStream(long pos)intsetString(long pos, java.lang.String str)intsetString(long pos, java.lang.String str, int offset, int len)voidtruncate(long len)-
Methods inherited from class org.apache.derby.client.am.Lob
completeLocalCommit, completeLocalRollback, getAgent, getLocator, isLocator, listenToUnitOfWork, willBeLayerBStreamed
-
-
-
-
Constructor Detail
-
ClientClob
public ClientClob(Agent agent, java.lang.String string)
-
ClientClob
public ClientClob(Agent agent, byte[] unconvertedBytes, java.nio.charset.Charset charset, int dataOffset) throws SqlException
- Throws:
SqlException
-
ClientClob
public ClientClob(Agent agent, java.io.InputStream inputStream, java.nio.charset.Charset encoding, int length)
-
ClientClob
public ClientClob(Agent agent, int locator)
Create aClientClobobject for a Clob value stored on the server and indentified bylocator.- Parameters:
agent- context for thisClobobject (incl. connection).locator- reference id toClobvalue on server.
-
-
Method Detail
-
length
public long length() throws java.sql.SQLException
-
getSubString
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLExceptionReturns a copy of the specified substring in theCLOBvalue designated by thisClientClobobject. The substring begins at positionposand has up tolengthconsecutive characters. The starting position must be between 1 and the length of the CLOB plus 1. This allows for zero-length CLOB values, from which only zero-length substrings can be returned. If a larger length is requested than there are characters available, characters to the end of the CLOB are returned.- Specified by:
getSubStringin interfacejava.sql.Clob- Parameters:
pos- the first character of the substring to be extracted. The first character is at position 1.length- the number of consecutive characters to be copied- Returns:
- a
Stringthat is the specified substring in theCLOBvalue designated by thisClientClobobject - Throws:
java.sql.SQLException- if there is an error accessing theCLOBNOTE: If the starting position is the length of the CLOB plus 1, zero characters are returned regardless of the length requested.
-
getCharacterStream
public java.io.Reader getCharacterStream() throws java.sql.SQLException- Specified by:
getCharacterStreamin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
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) throws java.sql.SQLException- Specified by:
positionin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
position
public long position(java.sql.Clob searchstr, long start) throws java.sql.SQLException- Specified by:
positionin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
setString
public int setString(long pos, java.lang.String str) throws java.sql.SQLException- Specified by:
setStringin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
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
-
setCharacterStream
public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
truncate
public void truncate(long len) throws java.sql.SQLException- Specified by:
truncatein interfacejava.sql.Clob- Throws:
java.sql.SQLException
-
free
public void free() throws java.sql.SQLExceptionThis method frees theClobobject and releases the resources the resources that it holds. The object is invalid once thefreemethod is called. Iffreeis called multiple times, the subsequent calls tofreeare treated as a no-op.- Specified by:
freein interfacejava.sql.Clob- Throws:
java.sql.SQLException- if an error occurs releasing the Clob's resources
-
getCharacterStream
public java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLExceptionReturns aReaderobject that contains a partialClobvalue, 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:
Readerthrough which the partialClobvalue can be read.- Throws:
java.sql.SQLException- if pos is less than 1 or if pos is greater than the number of characters in theClobor ifpos + lengthis greater thanClob.length() +1
-
isString
public boolean isString()
-
isAsciiStream
public boolean isAsciiStream()
-
isCharacterStream
public boolean isCharacterStream()
-
isUnicodeStream
public boolean isUnicodeStream()
-
getUnicodeStream
public java.io.InputStream getUnicodeStream()
-
getString
public java.lang.String getString()
-
getUtf8String
public byte[] getUtf8String()
-
getUTF8Length
public int getUTF8Length()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG