From: <one...@us...> - 2003-01-25 09:30:32
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob In directory sc8-pr-cvs1:/tmp/cvs-serv25897/lob Modified Files: BlobImpl.java ClobImpl.java Log Message: added createClob(), createBlob() for streams Index: BlobImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob/BlobImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlobImpl.java 25 Dec 2002 02:00:15 -0000 1.1 --- BlobImpl.java 25 Jan 2003 09:30:29 -0000 1.2 *************** *** 10,30 **** public class BlobImpl implements Blob { ! private byte[] bytes; ! ! public byte[] toBytes() { ! return bytes; } ! public BlobImpl(byte[] bytes) { ! this.bytes = bytes; } ! /** * @see java.sql.Blob#length() */ public long length() throws SQLException { ! return bytes.length; } ! /** * @see java.sql.Blob#truncate(long) --- 10,33 ---- 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; } ! /** * @see java.sql.Blob#length() */ public long length() throws SQLException { ! return length; } ! /** * @see java.sql.Blob#truncate(long) *************** *** 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/Hibernate/cirrus/hibernate/lob/ClobImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClobImpl.java 25 Dec 2002 02:00:15 -0000 1.1 --- ClobImpl.java 25 Jan 2003 09:30:29 -0000 1.2 *************** *** 2,10 **** package cirrus.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 cirrus.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,33 **** public class ClobImpl implements Clob { ! private char[] chars; public ClobImpl(String string) { ! chars = string.toCharArray(); ! } ! ! public String toString() { ! return new String(chars); } /** * @see java.sql.Clob#length() */ public long length() throws SQLException { ! return chars.length; } ! /** * @see java.sql.Clob#truncate(long) --- 12,35 ---- 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; + } + /** * @see java.sql.Clob#length() */ public long length() throws SQLException { ! return length; } ! /** * @see java.sql.Clob#truncate(long) *************** *** 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; } |