1 package org.hibernate.lob; 3 4 import java.io.InputStream ; 5 import java.io.OutputStream ; 6 import java.io.Reader ; 7 import java.io.Serializable ; 8 import java.io.Writer ; 9 import java.sql.Clob ; 10 import java.sql.SQLException ; 11 12 15 public class SerializableClob implements Serializable , Clob { 16 17 private transient final Clob clob; 18 19 public SerializableClob(Clob blob) { 20 this.clob = blob; 21 } 22 23 public Clob getWrappedClob() { 24 if ( clob==null ) { 25 throw new IllegalStateException ("Clobs may not be accessed after serialization"); 26 } 27 else { 28 return clob; 29 } 30 } 31 32 public long length() throws SQLException { 33 return getWrappedClob().length(); 34 } 35 36 public String getSubString(long pos, int length) throws SQLException { 37 return getWrappedClob().getSubString(pos, length); 38 } 39 40 public Reader getCharacterStream() throws SQLException { 41 return getWrappedClob().getCharacterStream(); 42 } 43 44 public InputStream getAsciiStream() throws SQLException { 45 return getWrappedClob().getAsciiStream(); 46 } 47 48 public long position(String searchstr, long start) throws SQLException { 49 return getWrappedClob().position(searchstr, start); 50 } 51 52 public long position(Clob searchstr, long start) throws SQLException { 53 return getWrappedClob().position(searchstr, start); 54 } 55 56 public int setString(long pos, String str) throws SQLException { 57 return getWrappedClob().setString(pos, str); 58 } 59 60 public int setString(long pos, String str, int offset, int len) throws SQLException { 61 return getWrappedClob().setString(pos, str, offset, len); 62 } 63 64 public OutputStream setAsciiStream(long pos) throws SQLException { 65 return getWrappedClob().setAsciiStream(pos); 66 } 67 68 public Writer setCharacterStream(long pos) throws SQLException { 69 return getWrappedClob().setCharacterStream(pos); 70 } 71 72 public void truncate(long len) throws SQLException { 73 getWrappedClob().truncate(len); 74 } 75 76 } 77 | Popular Tags |