Package org.teiid.core.types
Class BlobImpl
- java.lang.Object
-
- org.teiid.core.types.BaseLob
-
- org.teiid.core.types.BlobImpl
-
- All Implemented Interfaces:
Externalizable,Serializable,Blob,InputStreamFactory.StreamFactoryReference,LobSearchUtil.StreamProvider
public class BlobImpl extends BaseLob implements Blob, LobSearchUtil.StreamProvider
This object holds a chunk of binary data and implements the JDBC Blob interface. It presents a streaming interface and provides a way to access partial of the blob data. Connectors can use this object when dealing with large objects.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BlobImpl()BlobImpl(InputStreamFactory streamFactory)Creates a MMBlob object with thevalueID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetBinaryStream(long arg0, long arg1)byte[]getBytes(long pos, int length)Returns as an array of bytes, part or all of theBLOBvalue that thisBlobobject designates.longposition(byte[] pattern, long start)Determines the byte position at which the specified bytepatternbegins within theBLOBvalue that thisBlobobject represents.longposition(Blob pattern, long start)Determines the byte position in theBLOBvalue designated by thisBlobobject at whichpatternbegins.OutputStreamsetBinaryStream(long pos)intsetBytes(long pos, byte[] bytes)intsetBytes(long pos, byte[] bytes, int offset, int len)voidtruncate(long len)-
Methods inherited from class org.teiid.core.types.BaseLob
free, getBinaryStream, getCharacterStream, getCharset, getStreamFactory, length, readExternal, setCharset, setEncoding, setStreamFactory, writeExternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Blob
free, getBinaryStream, length
-
Methods inherited from interface org.teiid.core.types.LobSearchUtil.StreamProvider
getBinaryStream
-
-
-
-
Constructor Detail
-
BlobImpl
public BlobImpl()
-
BlobImpl
public BlobImpl(InputStreamFactory streamFactory)
Creates a MMBlob object with thevalueID.- Parameters:
streamFactory- reference to value chunk in data source.
-
-
Method Detail
-
getBytes
public byte[] getBytes(long pos, int length) throws SQLExceptionReturns as an array of bytes, part or all of theBLOBvalue that thisBlobobject designates. The byte array contains up tolengthconsecutive bytes starting at positionpos.- Specified by:
getBytesin interfaceBlob- Parameters:
pos- the ordinal position of the first byte in theBLOBvalue to be extracted; the first byte is at position 1length- the number of consecutive bytes to be copied- Returns:
- a byte array containing up to
lengthconsecutive bytes from theBLOBvalue designated by thisBlobobject, starting with the byte at positionpos - Throws:
SQLException- if there is an error accessing theBLOB
-
position
public long position(Blob pattern, long start) throws SQLException
Determines the byte position in theBLOBvalue designated by thisBlobobject at whichpatternbegins. The search begins at positionstart.- Specified by:
positionin interfaceBlob- Parameters:
pattern- theBlobobject designating theBLOBvalue for which to searchstart- the position in theBLOBvalue at which to begin searching; the first position is 1- Returns:
- the position at which the pattern begins, else -1
- Throws:
SQLException- if there is an error accessing theBLOB
-
position
public long position(byte[] pattern, long start) throws SQLExceptionDetermines the byte position at which the specified bytepatternbegins within theBLOBvalue that thisBlobobject represents. The search forpatternbegins at positionstart.- Specified by:
positionin interfaceBlob- Parameters:
pattern- the byte array for which to searchstart- the position at which to begin searching; the first position is 1- Returns:
- the position at which the pattern appears, else -1
- Throws:
SQLException- if there is an error accessing theBLOB
-
getBinaryStream
public InputStream getBinaryStream(long arg0, long arg1) throws SQLException
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes) throws SQLException- Specified by:
setBytesin interfaceBlob- Throws:
SQLException- See Also:
Blob.setBytes(long, byte[])
-
setBytes
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException- Specified by:
setBytesin interfaceBlob- Throws:
SQLException- See Also:
Blob.setBytes(long, byte[], int, int)
-
setBinaryStream
public OutputStream setBinaryStream(long pos) throws SQLException
- Specified by:
setBinaryStreamin interfaceBlob- Throws:
SQLException- See Also:
Blob.setBinaryStream(long)
-
truncate
public void truncate(long len) throws SQLException- Specified by:
truncatein interfaceBlob- Throws:
SQLException- See Also:
Blob.truncate(long)
-
-