1 2 11 12 package org.objectweb.rmijdbc; 13 14 import java.sql.*; 15 import java.io.IOException ; 16 import java.io.InputStream ; 17 import java.io.Reader ; 18 import java.rmi.RemoteException ; 19 import java.rmi.server.UnicastRemoteObject ; 20 import java.rmi.server.Unreferenced ; 21 22 23 public class RJClobServer 24 extends UnicastRemoteObject 25 implements RJClobInterface, Unreferenced { 26 27 java.sql.Clob jdbcClob_; 28 29 public RJClobServer(java.sql.Clob b) throws RemoteException { 30 super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); 31 jdbcClob_ = b; 32 } 33 34 public void unreferenced() { Runtime.getRuntime().gc(); } 35 36 public char[] getCharacterStream() throws RemoteException , SQLException { 39 try { 40 Reader r = jdbcClob_.getCharacterStream(); 41 return RJSerializer.toCharArray(r); 42 } catch(IOException e) { 43 throw new java.rmi.RemoteException ( 44 "RJClobServer::getCharacterStream()", e); 45 } 46 } 47 48 public long length() throws RemoteException , SQLException { 49 return jdbcClob_.length(); 50 } 51 52 public String getSubString(long pos, int length) 53 throws RemoteException , SQLException { 54 return jdbcClob_.getSubString(pos, length); 55 } 56 57 public byte[] getAsciiStream() throws RemoteException , SQLException { 60 try { 61 InputStream s = jdbcClob_.getAsciiStream(); 62 return RJSerializer.toByteArray(s); 63 } catch(IOException e) { 64 throw new java.rmi.RemoteException ( 65 "RJClobServer::getBinaryStream()", e); 66 } 67 } 68 69 public long position(String searchstr, long start) 70 throws RemoteException , SQLException { 71 return jdbcClob_.position(searchstr, start); 72 } 73 74 public long position(Clob pattern, long start) 75 throws RemoteException , SQLException { 76 return jdbcClob_.position(pattern, start); 77 } 78 79 public int setString(long pos, String str) 81 throws RemoteException , SQLException { 82 return jdbcClob_.setString(pos, str); 83 } 84 85 public int setString(long pos, String str, int offset, int len) 86 throws RemoteException , SQLException { 87 return jdbcClob_.setString(pos, str, offset, len); 88 } 89 90 public java.io.OutputStream setAsciiStream(long pos) 91 throws RemoteException , SQLException { 92 return jdbcClob_.setAsciiStream(pos); 93 } 94 95 public java.io.Writer setCharacterStream(long pos) 96 throws RemoteException , SQLException { 97 return jdbcClob_.setCharacterStream(pos); 98 } 99 100 public void truncate(long len) 101 throws RemoteException , SQLException { 102 jdbcClob_.truncate(len); 103 } 104 105 }; 106 107 | Popular Tags |