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, the getContent
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 ContentType of the
Content.
Once an OleBlob is no longer useful, it should be closed using free or 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();
}
}
io.github.spannm.jackcess.util
back to summary
public Interface OleBlob.CompoundContent
extends PackageContent, EmbeddedContent, Iterable<OleBlob.CompoundContent.Entry>
- Known Direct Implementers
- io.github.spannm.jackcess.impl.CompoundOleUtil.CompoundContentImpl
Sub-interface for Content which has the
ContentType#COMPOUND_STORAGE type. Compound storage is a complex
embedding format also known as OLE2. In some situations (mostly non-microsoft office file formats) the actual
content is available from the
getContentsEntry method (if
hasContentsEntry returns
true). In other situations (e.g. microsoft office file formats), the actual content is most or all of the
compound content (but retrieving the final file may be a complex operation beyond the scope of jackcess). Note
that the CompoundContent type will only be available if the POI library is in the classpath, otherwise compound
content will be returned as OtherContent.
Nested and Inner Type Summary
| Modifier and Type | Class and Description
|
|---|
| public static interface |
|
Method Detail
| getContentsEntry | back to summary
|
|---|
| public OleBlob.CompoundContent.Entry getContentsEntry() throws IOException
|
| hasContentsEntry | back to summary
|
|---|
| public boolean hasContentsEntry() throws IOException
|
| stream | back to summary
|
|---|
| public default Stream<OleBlob.CompoundContent.Entry> stream() Returns a Stream using the default Iterator.
- Returns:Stream<OleBlob.CompoundContent.Entry>
a Stream using the default Iterator.
|
io.github.spannm.jackcess.util
back to summary
public Interface OleBlob.CompoundContent.Entry
extends EmbeddedContent
- Known Direct Implementers
- io.github.spannm.jackcess.impl.CompoundOleUtil.CompoundContentImpl.EntryImpl
A document entry in the compound storage.
io.github.spannm.jackcess.util
back to summary
public final Enum OleBlob.ContentType
extends Enum<OleBlob.ContentType>
- Class Inheritance
-
Enum describing the types of blob contents which are currently supported/understood
Field Summary
| Modifier and Type | Field and Description
|
|---|
| public static final OleBlob.ContentType | COMPOUND_STORAGEthe blob contents are a complex embedded data known as compound storage (aka OLE2).
|
| public static final OleBlob.ContentType | LINKthe blob contents are a link (file path) to some external content.
|
| public static final OleBlob.ContentType | OTHERthe top-level blob wrapper is understood, but the nested blob contents are unknown, probably just some
embedded content.
|
| public static final OleBlob.ContentType | SIMPLE_PACKAGEthe blob contents are a simple wrapper around some embedded content and related file names/paths.
|
| public static final OleBlob.ContentType | UNKNOWNthe top-level blob wrapper is not understood (this may not be a valid ole instance).
|
Constructor Summary
| Access | Constructor and Description
|
|---|
| private |
|
Field Detail
| COMPOUND_STORAGE | back to summary
|
|---|
| public static final OleBlob.ContentType COMPOUND_STORAGE the blob contents are a complex embedded data known as compound storage (aka OLE2). Working with compound
storage requires the optional POI library. Content will be an instance of CompoundContent. If the POI library
is not available on the classpath, then compound storage data will instead be returned as type
OTHER.
|
| LINK | back to summary
|
|---|
| public static final OleBlob.ContentType LINK the blob contents are a link (file path) to some external content. Content will be an instance of LinkContent
|
| OTHER | back to summary
|
|---|
| public static final OleBlob.ContentType OTHER the top-level blob wrapper is understood, but the nested blob contents are unknown, probably just some
embedded content. Content will be an instance of OtherContent
|
| SIMPLE_PACKAGE | back to summary
|
|---|
| public static final OleBlob.ContentType SIMPLE_PACKAGE the blob contents are a simple wrapper around some embedded content and related file names/paths. Content
will be an instance SimplePackageContent
|
| UNKNOWN | back to summary
|
|---|
| public static final OleBlob.ContentType UNKNOWN the top-level blob wrapper is not understood (this may not be a valid ole instance). Content will simply be
an instance of Content (the data can be accessed from the main blob instance)
|
Constructor Detail
| ContentType | back to summary
|
|---|
| private ContentType()
|
Method Detail
| values | back to summary
|
|---|
| public static OleBlob.ContentType[] values()
|
io.github.spannm.jackcess.util
back to summary
public Interface OleBlob.LinkContent
extends PackageContent
- Known Direct Implementers
- io.github.spannm.jackcess.impl.OleUtil.LinkContentImpl
Sub-interface for Content which has the
ContentType#LINK type. The actual content is external to the
access database and can be found at
getLinkPath.
Method Detail
| getFileName | back to summary
|
|---|
| public String getFileName()
|
| getFilePath | back to summary
|
|---|
| public String getFilePath()
|
| getLinkPath | back to summary
|
|---|
| public String getLinkPath()
|
| getLinkStream | back to summary
|
|---|
| public InputStream getLinkStream() throws IOException
|
io.github.spannm.jackcess.util
back to summary
public Interface OleBlob.OtherContent
extends PackageContent, EmbeddedContent
- Known Direct Implementers
- io.github.spannm.jackcess.impl.OleUtil.OtherContentImpl
Sub-interface for Content which has the
ContentType#OTHER type. This may be a simple embedded file or
some other, currently not understood complex type.
io.github.spannm.jackcess.util
back to summary
public Interface OleBlob.SimplePackageContent
extends PackageContent, EmbeddedContent
- Known Direct Implementers
- io.github.spannm.jackcess.impl.OleUtil.SimplePackageContentImpl
Sub-interface for Content which has the
ContentType#SIMPLE_PACKAGE type. The actual content is embedded
within the access database (but the original file source path can also be found at
getFilePath).
Method Detail
| getFileName | back to summary
|
|---|
| public String getFileName()
|
| getFilePath | back to summary
|
|---|
| public String getFilePath()
|
| getLocalFilePath | back to summary
|
|---|
| public String getLocalFilePath()
|