1 2 9 10 package org.objectweb.rmijdbc; 11 12 import java.sql.*; 13 import java.io.InputStream ; 14 import java.rmi.RemoteException ; 15 16 33 34 public class RJBlob implements java.sql.Blob , java.io.Serializable 35 { 36 37 RJBlobInterface rmiBlob_; 38 39 public RJBlob(RJBlobInterface b) { 40 rmiBlob_ = b; 41 } 42 43 public long length() throws SQLException { 44 try { 45 return rmiBlob_.length(); 46 } catch(RemoteException e) { 47 throw new java.sql.SQLException (e.getMessage()); 48 } 49 } 50 51 public byte[] getBytes(long pos, int length) throws SQLException { 52 try { 53 return rmiBlob_.getBytes(pos, length); 54 } catch(RemoteException e) { 55 throw new java.sql.SQLException (e.getMessage()); 56 } 57 } 58 59 public InputStream getBinaryStream() throws SQLException { 61 try { 62 byte[] val = rmiBlob_.getBinaryStream(); 63 return RJSerializer.toInputStream(val); 64 } catch(Exception e) { 65 throw new java.sql.SQLException (e.getMessage()); 66 } 67 } 68 69 public long position(byte[] pattern, long start) throws SQLException { 70 try { 71 return rmiBlob_.position(pattern, start); 72 } catch(RemoteException e) { 73 throw new java.sql.SQLException (e.getMessage()); 74 } 75 } 76 77 public long position(Blob pattern, long start) throws SQLException { 78 try { 79 return rmiBlob_.position(pattern.getBytes(0, (int)pattern.length()), start); 82 } catch(RemoteException e) { 83 throw new java.sql.SQLException (e.getMessage()); 84 } 85 } 86 87 89 public int setBytes(long pos, byte[] bytes) throws SQLException 90 { 91 try { 92 return rmiBlob_.setBytes(pos, bytes); 93 } catch(RemoteException e) { 94 throw new java.sql.SQLException (e.getMessage()); 95 } 96 } 97 98 public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException 99 { 100 try { 101 return rmiBlob_.setBytes(pos, bytes, offset, len); 102 } catch(RemoteException e) { 103 throw new java.sql.SQLException (e.getMessage()); 104 } 105 } 106 107 public java.io.OutputStream setBinaryStream(long pos) throws SQLException 108 { 109 try { 110 return rmiBlob_.setBinaryStream(pos); 111 } catch(Exception e) { 112 throw new java.sql.SQLException (e.getMessage()); 113 } 114 } 115 116 public void truncate(long len) throws SQLException 117 { 118 try { 119 rmiBlob_.truncate(len); 120 } catch(RemoteException e) { 121 throw new java.sql.SQLException (e.getMessage()); 122 } 123 } 124 125 }; 126 127 | Popular Tags |