Class ClientClob
java.lang.Object
org.apache.derby.client.am.Lob
org.apache.derby.client.am.ClientClob
- All Implemented Interfaces:
Clob, UnitOfWorkListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate InputStreamprivate Readerprotected Stringprivate InputStreamprivate byte[]Fields inherited from class Lob
agent_, ASCII_STREAM, BINARY_STREAM, BINARY_STRING, CHARACTER_STREAM, dataType_, INVALID_LOCATOR, isValid_, LOCATOR, locator_, STRING, UNICODE_STREAM -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateClientClob(Agent agent, boolean willBeLayerBStreamed) ClientClob(Agent agent, byte[] unconvertedBytes, Charset charset, int dataOffset) ClientClob(Agent agent, int locator) Create aClientClobobject for a Clob value stored on the server and indentified bylocator.(package private)ClientClob(Agent agent, InputStream inputStream, Charset encoding) Create aClientClobof unknown length with the specified encoding.ClientClob(Agent agent, InputStream inputStream, Charset encoding, int length) (package private)ClientClob(Agent agent, Reader reader) Create aClientClobof unknown length.(package private)ClientClob(Agent agent, Reader reader, int length) ClientClob(Agent agent, String string) -
Method Summary
Modifier and TypeMethodDescriptionvoidfree()This method frees theClobobject and releases the resources the resources that it holds.(package private) InputStreamgetCharacterStream(long pos, long length) Returns aReaderobject that contains a partialClobvalue, starting with the character specified by pos, which is length characters in length.(package private) Reader(package private) longGet the length in bytes of theClobvalue represented by this locator basedClobobject.getSubString(long pos, int length) Returns a copy of the specified substring in theCLOBvalue designated by thisClientClobobject.private StringgetSubStringX(long pos, int length) intbyte[]booleanbooleanbooleanisString()booleanlonglength()protected voidMaterialize the stream used for input to the database.longlongprivate longprivate long(package private) voidreInitForNonLocator(String newString) Reinitialize the value of this CLOB.setAsciiStream(long pos) setCharacterStream(long pos) intint(package private) intsetStringX(long pos, String str, int offset, int len) voidtruncate(long len) Methods inherited from class Lob
checkForClosedConnection, checkForLocatorValidity, checkPosAndLength, checkValidity, completeLocalCommit, completeLocalRollback, getAgent, getLocator, getUpdateCount, incrementUpdateCount, isLayerBStreamingPossible, isLocator, listenToUnitOfWork, materializeStream, setSqlLength, sqlLength, willBeLayerBStreamed
-
Field Details
-
string_
-
asciiStream_
-
unicodeStream_
-
characterStream_
-
utf8String_
private byte[] utf8String_
-
-
Constructor Details
-
ClientClob
-
ClientClob
public ClientClob(Agent agent, byte[] unconvertedBytes, Charset charset, int dataOffset) throws SqlException - Throws:
SqlException
-
ClientClob
-
ClientClob
ClientClob(Agent agent, InputStream inputStream, Charset encoding) throws SqlException Create aClientClobof unknown length with the specified encoding. This constructor was added to support the JDBC 4 length less overloads. Note that aClientClobcreated with this constructor is made for input to the database only. Do not pass it out to the user!- Parameters:
agent-inputStream- the data to insertencoding- encoding to use for characters. Only "ISO-8859-1" is allowed.- Throws:
SqlException
-
ClientClob
-
ClientClob
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.
-
ClientClob
Create aClientClobof unknown length. This constructor was added to support the JDBC 4 length less overloads. Note that aClientClobcreated with this constructor is made for input to the database only. Do not pass it out to the user!- Parameters:
agent-reader- the data to insert
-
ClientClob
-
-
Method Details
-
length
- Specified by:
lengthin interfaceClob- Specified by:
lengthin classLob- Throws:
SQLException
-
getSubString
Returns 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 interfaceClob- 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:
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.
-
getSubStringX
- Throws:
SqlException
-
getCharacterStream
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException
-
getCharacterStreamX
- Throws:
SqlException
-
getAsciiStream
- Specified by:
getAsciiStreamin interfaceClob- Throws:
SQLException
-
getAsciiStreamX
- Throws:
SqlException
-
position
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
positionX
- Throws:
SqlException
-
position
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
positionX
- Throws:
SqlException
-
setString
- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
setString
- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
setStringX
- Throws:
SqlException
-
setAsciiStream
- Specified by:
setAsciiStreamin interfaceClob- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfaceClob- Throws:
SQLException
-
truncate
- Specified by:
truncatein interfaceClob- Throws:
SQLException
-
free
This 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 interfaceClob- Throws:
SQLException- if an error occurs releasing the Clob's resources
-
getCharacterStream
Returns aReaderobject that contains a partialClobvalue, starting with the character specified by pos, which is length characters in length.- Specified by:
getCharacterStreamin 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:
Readerthrough which the partialClobvalue can be read.- Throws:
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
-
getString
-
getUtf8String
public byte[] getUtf8String() -
getUTF8Length
public int getUTF8Length() -
reInitForNonLocator
Reinitialize the value of this CLOB. This is legacy code, only used when talking to servers that don't support locators.- Parameters:
newString- the new value
-
materializeStream
Materialize the stream used for input to the database.- Specified by:
materializeStreamin classLob- Throws:
SqlException
-
getLocatorLength
Get the length in bytes of theClobvalue represented by this locator basedClobobject. A stored procedure call will be made to get it from the server.- Overrides:
getLocatorLengthin classLob- Returns:
- length of
Clobin bytes - Throws:
SqlException
-