Package org.postgresql.jdbc
Class AbstractBlobClob
java.lang.Object
org.postgresql.jdbc.AbstractBlobClob
This class holds all of the methods common to both Blobs and Clobs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Iterates over a large object returning byte values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BaseConnection
private LargeObject
private boolean
private final long
private ArrayList<LargeObject>
We create separate LargeObjects for methods that use streams so they won't interfere with each other.private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addSubLO
(LargeObject subLO) protected void
assertPosition
(long pos) Throws an exception if the pos value exceeds the max value by which the large object API can index.protected void
assertPosition
(long pos, long len) Throws an exception if the pos value exceeds the max value by which the large object API can index.protected void
Checks that this LOB hasn't been free()d already.void
free()
byte[]
getBytes
(long pos, int length) protected LargeObject
getLo
(boolean forWrite) long
length()
long
position
(byte[] pattern, long start) Iterate over the buffer looking for the specified pattern.long
This is simply passing the byte value of the pattern Blob.setBinaryStream
(long pos) void
truncate
(long len) For Blobs this should be in bytes while for Clobs it should be in characters.
-
Field Details
-
conn
-
currentLo
-
currentLoIsWriteable
private boolean currentLoIsWriteable -
support64bit
private boolean support64bit -
subLOs
We create separate LargeObjects for methods that use streams so they won't interfere with each other. -
oid
private final long oid
-
-
Constructor Details
-
AbstractBlobClob
- Throws:
SQLException
-
-
Method Details
-
free
- Throws:
SQLException
-
truncate
For Blobs this should be in bytes while for Clobs it should be in characters. Since we really haven't figured out how to handle character sets for Clobs the current implementation uses bytes for both Blobs and Clobs.- Parameters:
len
- maximum length- Throws:
SQLException
- if operation fails
-
length
- Throws:
SQLException
-
getBytes
- Throws:
SQLException
-
getBinaryStream
- Throws:
SQLException
-
setBinaryStream
- Throws:
SQLException
-
position
Iterate over the buffer looking for the specified pattern.- Parameters:
pattern
- A pattern of bytes to search the blob forstart
- The position to start reading from- Returns:
- position of the specified pattern
- Throws:
SQLException
- if something wrong happens
-
position
This is simply passing the byte value of the pattern Blob.- Parameters:
pattern
- search patternstart
- start position- Returns:
- position of given pattern
- Throws:
SQLException
- if something goes wrong
-
assertPosition
Throws an exception if the pos value exceeds the max value by which the large object API can index.- Parameters:
pos
- Position to write at.- Throws:
SQLException
- if something goes wrong
-
assertPosition
Throws an exception if the pos value exceeds the max value by which the large object API can index.- Parameters:
pos
- Position to write at.len
- number of bytes to write.- Throws:
SQLException
- if something goes wrong
-
checkFreed
Checks that this LOB hasn't been free()d already.- Throws:
SQLException
- if LOB has been freed.
-
getLo
- Throws:
SQLException
-
addSubLO
-