Package com.microsoft.sqlserver.jdbc

# Class SQLServerBlob

java.lang.Object
com.microsoft.sqlserver.jdbc.SQLServerBlob

All Implemented Interfaces:
  `Serializable`, `Blob`

public final class SQLServerBlob extends Object implements Blob, Serializable
Represents a binary LOB object and implements a java.sql.Blob.

See Also:
  Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`SQLServerBlob​(SQLServerConnection connection, byte[] data)`
Deprecated.
Use `SQLServerConnection.createBlob()` instead.

## Method Summary

Modifier and Type
Method
Description
`void`
`free()`
`InputStream`
`getBinaryStream()`
`InputStream`
`getBinaryStream​(long pos, long length)`
`byte[]`
`getBytes​(long pos, int length)`
`long`
`length()`
`long`
`position​(byte[] bPattern, long start)`
`long`
`position​(Blob pattern, long start)`
`OutputStream`
`setBinaryStream​(long pos)`
`int`
`setBytes​(long pos, byte[] bytes)`
`int`
`setBytes​(long pos, byte[] bytes, int offset, int len)`
`String`
`toString()`
Returns string representation of object
`void`
`truncate​(long len)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### SQLServerBlob

@Deprecated public SQLServerBlob​(SQLServerConnection connection, byte[] data)
Deprecated.
Use `SQLServerConnection.createBlob()` instead.
Create a new BLOB

Parameters:
  `connection` - the database connection this blob is implemented on
  `data` - the BLOB's data

## Method Details

### toString

public final String toString()
Returns string representation of object

Overrides:
  `toString` in class `Object`

### free

public void free() throws SQLException

Specified by:
  `free` in interface `Blob`
Throws:
  `SQLException`

### getBinaryStream

public InputStream getBinaryStream() throws SQLException

Specified by:
  `getBinaryStream` in interface `Blob`
Throws:
  `SQLException`

### getBinaryStream

public InputStream getBinaryStream​(long pos, long length) throws SQLException

Specified by:
  `getBinaryStream` in interface `Blob`
Throws:
  `SQLException`

### getBytes

public byte[] getBytes​(long pos, int length) throws SQLException

Specified by:
  `getBytes` in interface `Blob`
Throws:
  `SQLException`

### length

public long length() throws SQLException

Specified by:
  `length` in interface `Blob`
Throws:
  `SQLException`

### position

public long position​(Blob pattern, long start) throws SQLException

Specified by:
  `position` in interface `Blob`
Throws:
  `SQLException`

### position

public long position​(byte[] bPattern, long start) throws SQLException

Specified by:
  `position` in interface `Blob`
Throws:
  `SQLException`

### truncate

public void truncate​(long len) throws SQLException

Specified by:
  `truncate` in interface `Blob`
Throws:
  `SQLException`

### setBinaryStream

public OutputStream setBinaryStream​(long pos) throws SQLException

Specified by:
  `setBinaryStream` 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`