|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.jdbc.TemporaryClob.CharToBytePositionCache
private static class TemporaryClob.CharToBytePositionCache
A simple class to hold the byte position for a character position.
The implementation is very simple and is basically intended to speed up writing a sequence of consequtive characters one character at a time. Even though this should be avoided if possible, the penalty of updating a large Clob this way and finding the correct byte position by navigating from the start of the byte stream each time is so severe that a simple caching mechanism should be in place. Note that for other encodings than UTF-8, this might not be a problem if the mapping between character position and byte position is one-to-one.
Note that to ensure consistency between character and byte positions, access to this class must be synchronized externally to avoid caller 1 getting the character position, then caller 2 updates the cached values and then caller 1 gets the updated byte position.
| Field Summary | |
|---|---|
private long |
bytePos
|
private long |
charPos
|
| Constructor Summary | |
|---|---|
TemporaryClob.CharToBytePositionCache()
|
|
| Method Summary | |
|---|---|
(package private) long |
getBytePos()
Returns the last cached byte position. |
(package private) long |
getCharPos()
Returns the last cached character position. |
(package private) void |
reset()
Resets the position cache. |
(package private) void |
updateCachedPos(long charPos,
long bytePos)
Updates the position cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private long charPos
private long bytePos
| Constructor Detail |
|---|
TemporaryClob.CharToBytePositionCache()
| Method Detail |
|---|
long getBytePos()
long getCharPos()
void updateCachedPos(long charPos,
long bytePos)
charPos - the character position to cache the byte position forbytePos - byte position for the specified character positionvoid reset()
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||