aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java b/src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java
index 646ea970052..9a4b67dec66 100644
--- a/src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java
+++ b/src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java
@@ -58,16 +58,24 @@ public class BlobInputStream extends InputStream {
*/
public int read() throws java.io.IOException {
try {
- if(buffer==null || bpos>=buffer.length) {
+ if (buffer == null || bpos >= buffer.length) {
buffer=lo.read(bsize);
bpos=0;
}
// Handle EOF
- if(bpos>=buffer.length)
+ if(bpos >= buffer.length) {
return -1;
+ }
+
+ int ret = (buffer[bpos] & 0x7F);
+ if ((buffer[bpos] &0x80) == 0x80) {
+ ret |= 0x80;
+ }
- return (int) buffer[bpos++];
+ bpos++;
+
+ return ret;
} catch(SQLException se) {
throw new IOException(se.toString());
}
@@ -152,5 +160,4 @@ public class BlobInputStream extends InputStream {
public boolean markSupported() {
return true;
}
-
-} \ No newline at end of file
+}