org.apache.lucene.store.jdbc.support
Class InputStreamBlob
java.lang.Object
org.apache.lucene.store.jdbc.support.InputStreamBlob
- All Implemented Interfaces:
- Blob
public class InputStreamBlob
- extends Object
- implements Blob
A helper class that can wrap an InputStream as a Jdbc Blob.
Some jdbc drivers do not support the PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
method, but require using PreparedStatement.setBlob(int, java.sql.Blob). For code that already has
an InputStream ready, this Blob implementation can help.
- Author:
- kimchy
- See Also:
Dialect.useInputStreamToInsertBlob()
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InputStreamBlob
public InputStreamBlob(InputStream is,
long length)
length
public long length()
throws SQLException
- Specified by:
length in interface Blob
- Throws:
SQLException
truncate
public void truncate(long len)
throws SQLException
- Specified by:
truncate in interface Blob
- Throws:
SQLException
getBytes
public byte[] getBytes(long pos,
int length)
throws SQLException
- Specified by:
getBytes in interface Blob
- Throws:
SQLException
setBytes
public int setBytes(long pos,
byte[] bytes)
throws SQLException
- Specified by:
setBytes in interface Blob
- Throws:
SQLException
setBytes
public int setBytes(long pos,
byte[] bytes,
int offset,
int len)
throws SQLException
- Specified by:
setBytes in interface Blob
- Throws:
SQLException
position
public long position(byte[] pattern,
long start)
throws SQLException
- Specified by:
position in interface Blob
- Throws:
SQLException
getBinaryStream
public InputStream getBinaryStream()
throws SQLException
- Specified by:
getBinaryStream in interface Blob
- Throws:
SQLException
free
public void free()
throws SQLException
- Throws:
SQLException
getBinaryStream
public InputStream getBinaryStream(long pos,
long length)
throws SQLException
- Throws:
SQLException
setBinaryStream
public OutputStream setBinaryStream(long pos)
throws SQLException
- Specified by:
setBinaryStream in interface Blob
- Throws:
SQLException
position
public long position(Blob pattern,
long start)
throws SQLException
- Specified by:
position in interface Blob
- Throws:
SQLException
Copyright (c) 2004-2008 The Compass Project.