00001
00025 package org.objectweb.cjdbc.driver;
00026
00027
import java.io.ByteArrayInputStream;
00028
import java.io.Serializable;
00029
import java.sql.SQLException;
00030
00031
import org.objectweb.cjdbc.common.sql.NotImplementedException;
00032
00057 public class Blob implements java.sql.
Blob, Serializable
00058 {
00060 byte[]
binaryData = null;
00061
00067 public Blob(byte[] data)
00068 {
00069
binaryData = data;
00070 }
00071
00081 public long length() throws SQLException
00082 {
00083
return binaryData.length;
00084 }
00085
00104 public byte[]
getBytes(
long pos,
int length)
throws SQLException
00105 {
00106 byte[] newData =
new byte[
length];
00107
00108 System.arraycopy(
binaryData, (
int) (pos - 1), newData, 0,
length);
00109
00110
return newData;
00111 }
00112
00123 public java.io.InputStream
getBinaryStream() throws SQLException
00124 {
00125
return new ByteArrayInputStream(
binaryData);
00126 }
00127
00142 public long position(byte pattern[],
long start)
throws SQLException
00143 {
00144
return (
new String(
binaryData)).indexOf(
new String(pattern), (
int) start);
00145 }
00146
00161 public long position(java.sql.Blob pattern,
long start)
throws SQLException
00162 {
00163
return position(pattern.getBytes(0, (
int) pattern.length()), start);
00164 }
00165
00166
00167
00183 public int setBytes(
long pos, byte[] bytes)
throws SQLException
00184 {
00185
throw new NotImplementedException(
"setBytes");
00186 }
00187
00209 public int setBytes(
long pos, byte[] bytes,
int offset,
int len)
00210
throws SQLException
00211 {
00212
throw new NotImplementedException(
"setBytes");
00213 }
00214
00229 public java.io.OutputStream
setBinaryStream(
long pos)
throws SQLException
00230 {
00231
throw new NotImplementedException(
"setBinaryStream");
00232 }
00233
00245 public void truncate(
long len)
throws SQLException
00246 {
00247
throw new NotImplementedException(
"truncate");
00248 }
00249
00250
00251
00252
00253 }