From: <one...@us...> - 2003-01-25 09:35:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob In directory sc8-pr-cvs1:/tmp/cvs-serv27891/sf/hibernate/lob Modified Files: BlobImpl.java ClobImpl.java Log Message: added createClob(), createBlob() for streams Index: BlobImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob/BlobImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BlobImpl.java 5 Jan 2003 02:11:21 -0000 1.3 --- BlobImpl.java 25 Jan 2003 09:35:52 -0000 1.4 *************** *** 10,21 **** public class BlobImpl implements Blob { ! private byte[] bytes; ! ! public byte[] toBytes() { ! return bytes; } ! public BlobImpl(byte[] bytes) { ! this.bytes = bytes; } --- 10,24 ---- public class BlobImpl implements Blob { ! private InputStream stream; ! private int length; ! ! public BlobImpl(byte[] bytes) { ! this.stream = new ByteArrayInputStream(bytes); ! this.length = bytes.length; } ! public BlobImpl(InputStream stream, int length) { ! this.stream = stream; ! this.length = length; } *************** *** 24,28 **** */ public long length() throws SQLException { ! return bytes.length; } --- 27,31 ---- */ public long length() throws SQLException { ! return length; } *************** *** 67,71 **** */ public InputStream getBinaryStream() throws SQLException { ! return new ByteArrayInputStream(bytes); } --- 70,74 ---- */ public InputStream getBinaryStream() throws SQLException { ! return stream; } Index: ClobImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob/ClobImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClobImpl.java 5 Jan 2003 02:11:21 -0000 1.3 --- ClobImpl.java 25 Jan 2003 09:35:52 -0000 1.4 *************** *** 2,10 **** package net.sf.hibernate.lob; - import java.io.CharArrayReader; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; ! import java.io.StringBufferInputStream; import java.io.Writer; import java.sql.Clob; --- 2,9 ---- package net.sf.hibernate.lob; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; ! import java.io.StringReader; import java.io.Writer; import java.sql.Clob; *************** *** 13,24 **** public class ClobImpl implements Clob { ! private char[] chars; public ClobImpl(String string) { ! chars = string.toCharArray(); } ! ! public String toString() { ! return new String(chars); } --- 12,26 ---- public class ClobImpl implements Clob { ! private Reader reader; ! private int length; public ClobImpl(String string) { ! reader = new StringReader(string); ! length = string.length(); } ! ! public ClobImpl(Reader reader, int length) { ! this.reader = reader; ! this.length = length; } *************** *** 27,31 **** */ public long length() throws SQLException { ! return chars.length; } --- 29,33 ---- */ public long length() throws SQLException { ! return length; } *************** *** 41,45 **** */ public InputStream getAsciiStream() throws SQLException { ! return new StringBufferInputStream( new String(chars) ); } --- 43,47 ---- */ public InputStream getAsciiStream() throws SQLException { ! excep(); return null; } *************** *** 55,59 **** */ public Reader getCharacterStream() throws SQLException { ! return new CharArrayReader(chars); } --- 57,61 ---- */ public Reader getCharacterStream() throws SQLException { ! return reader; } |