KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > rmi > RmiClob


1 package com.daffodilwoods.rmi;
2
3  import java.io.*;
4  import java.sql.*;
5  import java.rmi.*;
6  import com.daffodilwoods.rmi.interfaces.*;
7  import com.daffodilwoods.rmi.*;
8
9 public class RmiClob implements Clob,Serializable{
10
11   _RmiClob clob_interface;
12   private long length = Integer.MIN_VALUE;
13   public RmiClob(_RmiClob clob_interface) throws RemoteException{
14     this.clob_interface = clob_interface;
15   }
16
17     public long length() throws SQLException {
18         try {
19           if(length == Integer.MIN_VALUE)
20             length =clob_interface.length();
21           return length;
22         }
23         catch (RemoteException re) {
24             throw new RuntimeException JavaDoc(re.getMessage());
25         }
26     }
27     public String JavaDoc getSubString(long pos, int length) throws SQLException {
28         try {
29           return clob_interface.getSubString(pos,length);
30         }
31         catch (RemoteException re) {
32             throw new RuntimeException JavaDoc(re.getMessage());
33         }
34     }
35
36     public Reader getCharacterStream() throws SQLException {
37         try {
38           return new RmiReader( clob_interface.getCharacterStream());
39         }
40         catch (RemoteException re) {
41             throw new RuntimeException JavaDoc(re.getMessage());
42         }
43     }
44
45     public InputStream getAsciiStream() throws SQLException {
46         try {
47           return new RmiInputStream( clob_interface.getAsciiStream());
48         }
49         catch (RemoteException re) {
50             throw new RuntimeException JavaDoc(re.getMessage());
51         }
52     }
53
54     public long position(String JavaDoc searchstr, long start) throws SQLException {
55         try {
56           return clob_interface.position(searchstr,start);
57         }
58         catch (RemoteException re) {
59             throw new RuntimeException JavaDoc(re.getMessage());
60         }
61     }
62
63     public long position(Clob searchstr, long start) throws SQLException {
64         try {
65           return clob_interface.position(searchstr,start);
66         }
67         catch (RemoteException re) {
68             throw new RuntimeException JavaDoc(re.getMessage());
69         }
70     }
71
72
73     public int setString(long pos, String JavaDoc str) throws SQLException {
74         try {
75           return clob_interface.setString(pos,str,1,(int)length());
76         }
77         catch (RemoteException re) {
78             throw new RuntimeException JavaDoc(re.getMessage());
79         }
80     }
81
82     public int setString(long pos, String JavaDoc str, int offset, int len) throws SQLException {
83         try {
84           return clob_interface.setString(pos,str,offset,len);
85         }
86         catch (RemoteException re) {
87             throw new RuntimeException JavaDoc(re.getMessage());
88         }
89     }
90
91
92     public OutputStream setAsciiStream(long pos) throws SQLException {
93         try {
94           return new RmiOutputStream (clob_interface.setAsciiStream(pos));
95         }
96         catch (RemoteException re) {
97             throw new RuntimeException JavaDoc(re.getMessage());
98         }
99     }
100
101     public Writer setCharacterStream(long pos) throws SQLException {
102         try {
103           return new RmiWriter (clob_interface.setCharacterStream(pos));
104         }
105         catch (RemoteException re) {
106             throw new RuntimeException JavaDoc(re.getMessage());
107         }
108     }
109
110     public void truncate(long len) throws SQLException {
111         try {
112            clob_interface.truncate(len);
113         }
114         catch (RemoteException re) {
115             throw new RuntimeException JavaDoc(re.getMessage());
116         }
117     }
118
119 }
120
Popular Tags