|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface OleBlob
Extensions of the Blob interface with additional functionality for working with the OLE content from an access database. The ole data type in access has a wide range of functionality (including wrappers with nested wrappers with nested filesystems!), and jackcess only supports a small portion of it. That said, jackcess should support the bulk of the common functionality.
The main Blob methods will interact with the entire OLE field data which, in most cases, contains additional wrapper information. In order to access the ultimate "content" contained within the OLE data, thegetContent() method should be used. The type of this content may be a
variety of formats, so additional sub-interfaces are available to interact
with it. The most specific sub-interface can be determined by the OleBlob.ContentType of the Content.
Once an OleBlob is no longer useful, it should be closed using
Blob.free() or Closeable.close() methods (after which, the instance will no
longer be functional).
Note, the OleBlob implementation is read-only (through the interface). In
order to modify blob contents, create a new OleBlob instance using OleBlob.Builder and write it to the access database.
Example for interpreting an existing OLE field:
OleBlob oleBlob = null;
try {
oleBlob = row.getBlob("MyOleColumn");
Content content = oleBlob.getContent()
if(content.getType() == OleBlob.ContentType.SIMPLE_PACKAGE) {
FileOutputStream out = ...;
((SimplePackageContent)content).writeTo(out);
out.closee();
}
} finally {
if(oleBlob != null) { oleBlob.close(); }
}
Example for creating new, embedded ole data:
OleBlob oleBlob = null;
try {
oleBlob = new OleBlob.Builder()
.setSimplePackage(new File("some_data.txt"))
.toBlob();
db.addRow(1, oleBlob);
} finally {
if(oleBlob != null) { oleBlob.close(); }
}
Example for creating new, linked ole data:
OleBlob oleBlob = null;
try {
oleBlob = new OleBlob.Builder()
.setLink(new File("some_data.txt"))
.toBlob();
db.addRow(1, oleBlob);
} finally {
if(oleBlob != null) { oleBlob.close(); }
}
| Nested Class Summary | |
|---|---|
static class |
OleBlob.Builder
Builder style class for constructing an OleBlob. |
static interface |
OleBlob.CompoundContent
Sub-interface for Content which has the OleBlob.ContentType.COMPOUND_STORAGE type. |
static interface |
OleBlob.Content
|
static class |
OleBlob.ContentType
Enum describing the types of blob contents which are currently supported/understood |
static interface |
OleBlob.EmbeddedContent
Intermediate sub-interface for Content which has embedded content. |
static interface |
OleBlob.LinkContent
Sub-interface for Content which has the OleBlob.ContentType.LINK type. |
static interface |
OleBlob.OtherContent
Sub-interface for Content which has the OleBlob.ContentType.OTHER type. |
static interface |
OleBlob.PackageContent
Intermediate sub-interface for Content which has a nested package. |
static interface |
OleBlob.SimplePackageContent
Sub-interface for Content which has the OleBlob.ContentType.SIMPLE_PACKAGE type. |
| Method Summary | |
|---|---|
OleBlob.Content |
getContent()
Returns the decoded form of the blob contents, if understandable. |
void |
writeTo(OutputStream out)
Writes the entire raw blob data to the given stream (this is the access db internal format, which includes all wrapper information). |
| Methods inherited from interface java.sql.Blob |
|---|
free, getBinaryStream, getBinaryStream, getBytes, length, position, position, setBinaryStream, setBytes, setBytes, truncate |
| Methods inherited from interface java.io.Closeable |
|---|
close |
| Method Detail |
|---|
void writeTo(OutputStream out)
throws IOException
out - stream to which the blob will be written
IOException
OleBlob.Content getContent()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||