Package org.eclipse.emf.cdo.common.lob

# Class CDOBlob

java.lang.Object
org.eclipse.emf.cdo.common.lob.CDOLobInfo
org.eclipse.emf.cdo.common.lob.CDOLob<InputStream>
org.eclipse.emf.cdo.common.lob.CDOBlob

public final class CDOBlob extends CDOLob<InputStream>
An identifiable binary large object with streaming support.

CDOBlobs are immutable. Once created, their `ID` and `size` do not change. The ID is a digest of the content of the blob, SHA-1 by default (see `CDOLobStoreImpl.DEFAULT_DIGEST_ALGORITHM`).

CDOBlobs can be created from an `InputStream`, a `byte[]`, or a hex-encoded `String`. On the client side, CDOBlobs are created with a reference to a `CDOLobStore`, which is used to store and retrieve the blob's content. On the server side, CDOBlobs are created without a store reference and are always retrieved from the repository's `IStore`.

The default `CDOLobStore` implementation is `CDOLobStoreImpl.INSTANCE`, which stores blobs in the local file system. But on the client side, it's often more efficient to use a dedicated `CDOLobStore` instance that stores blobs in a `CDOSession`-specific cache location. See `CDOSession.Options.setLobCache(CDOLobStore)` for details. See also `CDOSession.newBlob(InputStream)` and `CDOSession.newBlob(byte[])` for convenient ways to create CDOBlobs.

Since:
  4.0
Author:
  Eike Stepper

## Field Summary

### Fields inherited from class org.eclipse.emf.cdo.common.lob.CDOLob

`DEFAULT_STORE`

## Constructor Summary

Constructors
Constructor
Description
`CDOBlob(byte[] contents)`
`CDOBlob(byte[] contents, CDOLobStore store)`
`CDOBlob(InputStream contents)`
`CDOBlob(InputStream contents, CDOLobStore store)`
`CDOBlob(String contentsHexString)`
`CDOBlob(String contentsHexString, CDOLobStore store)`

## Method Summary

Modifier and Type
Method
Description
`void`
`copyTo(OutputStream out)`
`byte[]`
`getBytes()`
`InputStream`
`getContents()`
`File`
`getStoreFile()`
`String`
`getString()`
`protected CDOLobInfo`
`put(InputStream contents)`

### Methods inherited from class org.eclipse.emf.cdo.common.lob.CDOLob

`getByteCount, getStore`

### Methods inherited from class org.eclipse.emf.cdo.common.lob.CDOLobInfo

`equals, getID, getIDString, getSize, hashCode, toString`

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

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

## Constructor Details

### CDOBlob

public CDOBlob(InputStream contents) throws IOException

Throws:
  `IOException`

### CDOBlob

public CDOBlob(InputStream contents, CDOLobStore store) throws IOException

Throws:
  `IOException`

### CDOBlob

public CDOBlob(byte[] contents) throws IOException

Throws:
  `IOException`
Since:
  4.27

### CDOBlob

public CDOBlob(byte[] contents, CDOLobStore store) throws IOException

Throws:
  `IOException`
Since:
  4.13

### CDOBlob

public CDOBlob(String contentsHexString) throws IOException

Throws:
  `IOException`
Since:
  4.27

### CDOBlob

public CDOBlob(String contentsHexString, CDOLobStore store) throws IOException

Throws:
  `IOException`
Since:
  4.13

## Method Details

### getStoreFile

public File getStoreFile()

Specified by:
  `getStoreFile` in class `CDOLob<InputStream>`

### getContents

public InputStream getContents() throws IOException

Specified by:
  `getContents` in class `CDOLob<InputStream>`
Throws:
  `IOException`

### getBytes

public byte[] getBytes() throws IOException

Throws:
  `IOException`
Since:
  4.13

### getString

public String getString() throws IOException

Specified by:
  `getString` in class `CDOLob<InputStream>`
Throws:
  `IOException`
Since:
  4.13

### copyTo

public void copyTo(OutputStream out) throws IOException

Throws:
  `IOException`
Since:
  4.27

### put

protected CDOLobInfo put(InputStream contents) throws IOException

Specified by:
  `put` in class `CDOLob<InputStream>`
Throws:
  `IOException`