Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob
In directory sc8-pr-cvs1:/tmp/cvs-serv5389/hibernate/lob
Added Files:
BlobImpl.java ClobImpl.java
Log Message:
added ClobImpl, BlobImpl
--- NEW FILE: BlobImpl.java ---
//$Id: BlobImpl.java,v 1.1 2002/12/25 02:00:15 oneovthafew Exp $
package cirrus.hibernate.lob;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.SQLException;
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)
*/
public void truncate(long arg0) throws SQLException {
excep();
}
/**
* @see java.sql.Blob#getBytes(long, int)
*/
public byte[] getBytes(long arg0, int arg1) throws SQLException {
excep(); return null;
}
/**
* @see java.sql.Blob#setBytes(long, byte[])
*/
public int setBytes(long arg0, byte[] arg1) throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Blob#setBytes(long, byte[], int, int)
*/
public int setBytes(long arg0, byte[] arg1, int arg2, int arg3)
throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Blob#position(byte[], long)
*/
public long position(byte[] arg0, long arg1) throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Blob#getBinaryStream()
*/
public InputStream getBinaryStream() throws SQLException {
return new ByteArrayInputStream(bytes);
}
/**
* @see java.sql.Blob#setBinaryStream(long)
*/
public OutputStream setBinaryStream(long arg0) throws SQLException {
excep(); return null;
}
/**
* @see java.sql.Blob#position(Blob, long)
*/
public long position(Blob arg0, long arg1) throws SQLException {
excep(); return 0;
}
private void excep() {
throw new UnsupportedOperationException("Blob may not be manipulated from creating session");
}
}
--- NEW FILE: ClobImpl.java ---
//$Id: ClobImpl.java,v 1.1 2002/12/25 02:00:15 oneovthafew Exp $
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;
import java.sql.SQLException;
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)
*/
public void truncate(long arg0) throws SQLException {
excep();
}
/**
* @see java.sql.Clob#getAsciiStream()
*/
public InputStream getAsciiStream() throws SQLException {
return new StringBufferInputStream( new String(chars) );
}
/**
* @see java.sql.Clob#setAsciiStream(long)
*/
public OutputStream setAsciiStream(long arg0) throws SQLException {
excep(); return null;
}
/**
* @see java.sql.Clob#getCharacterStream()
*/
public Reader getCharacterStream() throws SQLException {
return new CharArrayReader(chars);
}
/**
* @see java.sql.Clob#setCharacterStream(long)
*/
public Writer setCharacterStream(long arg0) throws SQLException {
excep(); return null;
}
/**
* @see java.sql.Clob#getSubString(long, int)
*/
public String getSubString(long arg0, int arg1) throws SQLException {
excep(); return null;
}
/**
* @see java.sql.Clob#setString(long, String)
*/
public int setString(long arg0, String arg1) throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Clob#setString(long, String, int, int)
*/
public int setString(long arg0, String arg1, int arg2, int arg3)
throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Clob#position(String, long)
*/
public long position(String arg0, long arg1) throws SQLException {
excep(); return 0;
}
/**
* @see java.sql.Clob#position(Clob, long)
*/
public long position(Clob arg0, long arg1) throws SQLException {
excep(); return 0;
}
private void excep() {
throw new UnsupportedOperationException("Blob may not be manipulated from creating session");
}
}
|