1 23 24 package org.objectweb.cjdbc.driver; 25 26 import java.io.IOException ; 27 import java.io.OutputStream ; 28 import java.sql.SQLException ; 29 30 38 public class BlobOutputStream 39 extends OutputStream 40 { 41 42 Blob blob; 43 44 int currentPos; 45 46 53 public BlobOutputStream(Blob b, int startPos) 54 { 55 super(); 56 this.blob = b; 57 currentPos = startPos; 58 } 59 60 63 public void write(int b) throws IOException 64 { 65 blob.getInternalByteArray()[currentPos] = (byte) b; 66 currentPos++; 67 } 68 69 72 public void write(byte[] b, int off, int len) throws IOException 73 { 74 try 75 { 76 blob.setBytes(currentPos + 1, b, off, len); 78 currentPos += len; 79 } 80 catch (SQLException sqle) 81 { 82 throw (IOException ) new IOException (sqle.getLocalizedMessage()) 83 .initCause(sqle); 84 } 85 86 } 87 88 } 89 | Popular Tags |