APIdia Launch Partner
Top Description Inners Methods
io.github.spannm.jackcess.util

public Interface OleBlob

extends Blob, Closeable
Known Direct Implementers
io.github.spannm.jackcess.impl.OleUtil.OleBlobImpl
Imports
io.github.spannm.jackcess.impl.OleUtil, java.io.Closeable, .File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, .OutputStream, java.sql.Blob, java.util.stream.Stream, .StreamSupport

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();
    }
}

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
OleBlob.Builder

Builder style class for constructing an OleBlob.

public static interface
OleBlob.CompoundContent

Sub-interface for Content which has the ContentType#COMPOUND_STORAGE type.

public static interface
public static enum
OleBlob.ContentType

Enum describing the types of blob contents which are currently supported/understood

public static interface
OleBlob.EmbeddedContent

Intermediate sub-interface for Content which has embedded content.

public static interface
OleBlob.LinkContent

Sub-interface for Content which has the ContentType#LINK type.

public static interface
OleBlob.OtherContent

Sub-interface for Content which has the ContentType#OTHER type.

public static interface
OleBlob.PackageContent

Intermediate sub-interface for Content which has a nested package.

public static interface
OleBlob.SimplePackageContent

Sub-interface for Content which has the ContentType#SIMPLE_PACKAGE type.

Method Summary

Modifier and TypeMethod and Description
public OleBlob.Content
getContent()

Returns the decoded form of the blob contents, if understandable.

public void
writeTo(OutputStream
stream to which the blob will be written
out
)

Writes the entire raw blob data to the given stream (this is the access db internal format, which includes all wrapper information).

Inherited from java.io.Closeable:
close
Inherited from java.sql.Blob:
closefreegetBinaryStreamgetBinaryStreamgetByteslengthpositionpositionsetBinaryStreamsetBytessetBytestruncate

Method Detail

getContentback to summary
public OleBlob.Content getContent() throws IOException

Returns the decoded form of the blob contents, if understandable.

writeToback to summary
public void writeTo(OutputStream out) throws IOException

Writes the entire raw blob data to the given stream (this is the access db internal format, which includes all wrapper information).

Parameters
out:OutputStream

stream to which the blob will be written

io.github.spannm.jackcess.util back to summary

public Class OleBlob.Builder

extends Object
Class Inheritance

Builder style class for constructing an OleBlob. See OleBlob for example usage.

Field Summary

Modifier and TypeField and Description
private byte[]
private String
private long
private String
private String
public static final String
public static final String
private String
private InputStream
private OleBlob.ContentType
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static OleBlob
fromInternalData(byte[] bytes)

public byte[]
public String
public long
public String
public String
public String
public InputStream
public OleBlob.ContentType
public String
private void
public OleBlob
public OleBlob.Builder
withLinkFileName(String newFileName)

public OleBlob.Builder
public OleBlob.Builder
public OleBlob.Builder
withOtherBytes(byte[] newBytes)

public OleBlob.Builder
withOtherStream(InputStream in, long length)

public OleBlob.Builder
public OleBlob.Builder
public OleBlob.Builder
public OleBlob.Builder
public OleBlob.Builder
withSimplePackageBytes(byte[] newBytes)

public OleBlob.Builder
public OleBlob.Builder
public OleBlob.Builder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesback to summary
private byte[] bytes
classNameback to summary
private String className
contentLenback to summary
private long contentLen
fileNameback to summary
private String fileName
filePathback to summary
private String filePath
PACKAGE_PRETTY_NAMEback to summary
public static final String PACKAGE_PRETTY_NAME
PACKAGE_TYPE_NAMEback to summary
public static final String PACKAGE_TYPE_NAME
prettyNameback to summary
private String prettyName
streamback to summary
private InputStream stream
typeback to summary
private OleBlob.ContentType type
typeNameback to summary
private String typeName

Constructor Detail

Builderback to summary
public Builder()

Method Detail

fromInternalDataback to summary
public static OleBlob fromInternalData(byte[] bytes)
getBytesback to summary
public byte[] getBytes()
getClassNameback to summary
public String getClassName()
getContentLengthback to summary
public long getContentLength()
getFileNameback to summary
public String getFileName()
getFilePathback to summary
public String getFilePath()
getPrettyNameback to summary
public String getPrettyName()
getStreamback to summary
public InputStream getStream()
getTypeback to summary
public OleBlob.ContentType getType()
getTypeNameback to summary
public String getTypeName()
setDefaultPackageTypeback to summary
private void setDefaultPackageType()
toBlobback to summary
public OleBlob toBlob() throws IOException
withLinkFileNameback to summary
public OleBlob.Builder withLinkFileName(String newFileName)
withLinkPathback to summary
public OleBlob.Builder withLinkPath(String link)
withOtherback to summary
public OleBlob.Builder withOther(File f) throws FileNotFoundException
withOtherBytesback to summary
public OleBlob.Builder withOtherBytes(byte[] newBytes)
withOtherStreamback to summary
public OleBlob.Builder withOtherStream(InputStream in, long length)
withPackageClassNameback to summary
public OleBlob.Builder withPackageClassName(String newClassName)
withPackagePrettyNameback to summary
public OleBlob.Builder withPackagePrettyName(String newPrettyName)
withPackageTypeNameback to summary
public OleBlob.Builder withPackageTypeName(String newTypeName)
withSimplePackageback to summary
public OleBlob.Builder withSimplePackage(File f) throws FileNotFoundException
withSimplePackageBytesback to summary
public OleBlob.Builder withSimplePackageBytes(byte[] newBytes)
withSimplePackageFileNameback to summary
public OleBlob.Builder withSimplePackageFileName(String newFileName)
withSimplePackageFilePathback to summary
public OleBlob.Builder withSimplePackageFilePath(String newFilePath)
withSimplePackageStreamback to summary
public OleBlob.Builder withSimplePackageStream(InputStream in, long length)
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 TypeClass and Description
public static interface
OleBlob.CompoundContent.Entry

A document entry in the compound storage.

Method Summary

Modifier and TypeMethod and Description
public OleBlob.CompoundContent.Entry
public OleBlob.CompoundContent.Entry
getEntry(String entryName)

public boolean
public default Stream<OleBlob.CompoundContent.Entry>

Returns:

a Stream using the default Iterator.
stream
()

Returns a Stream using the default Iterator.

Inherited from io.github.spannm.jackcess.util.OleBlob.EmbeddedContent:
getStreamlengthwriteTo
Inherited from io.github.spannm.jackcess.util.OleBlob.PackageContent:
getClassNamegetPrettyNamegetTypeName
Inherited from java.lang.Iterable:
forEachiteratorspliterator

Method Detail

getContentsEntryback to summary
public OleBlob.CompoundContent.Entry getContentsEntry() throws IOException
getEntryback to summary
public OleBlob.CompoundContent.Entry getEntry(String entryName) throws IOException
hasContentsEntryback to summary
public boolean hasContentsEntry() throws IOException
streamback 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.

Method Summary

Modifier and TypeMethod and Description
public String
public OleBlob.CompoundContent
getParent()

Returns the CompoundContent which owns this entry.

Inherited from io.github.spannm.jackcess.util.OleBlob.EmbeddedContent:
getStreamlengthwriteTo

Method Detail

getNameback to summary
public String getName()
getParentback to summary
public OleBlob.CompoundContent getParent()

Returns the CompoundContent which owns this entry.

io.github.spannm.jackcess.util back to summary

public Interface OleBlob.Content

Known Direct Subinterfaces
io.github.spannm.jackcess.util.OleBlob.PackageContent, io.github.spannm.jackcess.util.OleBlob.EmbeddedContent
Known Direct Implementers
io.github.spannm.jackcess.impl.OleUtil.ContentImpl

Method Summary

Modifier and TypeMethod and Description
public OleBlob
getBlob()

Returns the blob which owns this content.

public OleBlob.ContentType
getType()

Returns the type of this content.

Method Detail

getBlobback to summary
public OleBlob getBlob()

Returns the blob which owns this content.

getTypeback to summary
public OleBlob.ContentType getType()

Returns the type of this content.

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 TypeField and Description
public static final OleBlob.ContentType
COMPOUND_STORAGE

the blob contents are a complex embedded data known as compound storage (aka OLE2).

public static final OleBlob.ContentType
LINK

the blob contents are a link (file path) to some external content.

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.

public static final OleBlob.ContentType
SIMPLE_PACKAGE

the blob contents are a simple wrapper around some embedded content and related file names/paths.

public static final OleBlob.ContentType
UNKNOWN

the top-level blob wrapper is not understood (this may not be a valid ole instance).

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static OleBlob.ContentType
public static OleBlob.ContentType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMPOUND_STORAGEback 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.

OTHERback 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_PACKAGEback 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

UNKNOWNback 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

ContentTypeback to summary
private ContentType()

Method Detail

valueOfback to summary
public static OleBlob.ContentType valueOf(String name)
valuesback to summary
public static OleBlob.ContentType[] values()
io.github.spannm.jackcess.util back to summary

public Interface OleBlob.EmbeddedContent

extends Content
Known Direct Subinterfaces
io.github.spannm.jackcess.util.OleBlob.SimplePackageContent, io.github.spannm.jackcess.util.OleBlob.CompoundContent, io.github.spannm.jackcess.util.OleBlob.CompoundContent.Entry, io.github.spannm.jackcess.util.OleBlob.OtherContent
Known Direct Implementers
io.github.spannm.jackcess.impl.OleUtil.EmbeddedContentImpl

Intermediate sub-interface for Content which has embedded content.

Method Summary

Modifier and TypeMethod and Description
public InputStream
public long
public void
Inherited from io.github.spannm.jackcess.util.OleBlob.Content:
getBlobgetType

Method Detail

getStreamback to summary
public InputStream getStream() throws IOException
lengthback to summary
public long length()
writeToback to summary
public void writeTo(OutputStream out) throws IOException
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 Summary

Modifier and TypeMethod and Description
public String
public String
public String
public InputStream
Inherited from io.github.spannm.jackcess.util.OleBlob.PackageContent:
getClassNamegetPrettyNamegetTypeName

Method Detail

getFileNameback to summary
public String getFileName()
getFilePathback to summary
public String getFilePath()
getLinkPathback to summary
public String getLinkPath()
getLinkStreamback 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.

Method Summary

Inherited from io.github.spannm.jackcess.util.OleBlob.EmbeddedContent:
getStreamlengthwriteTo
Inherited from io.github.spannm.jackcess.util.OleBlob.PackageContent:
getClassNamegetPrettyNamegetTypeName
io.github.spannm.jackcess.util back to summary

public Interface OleBlob.PackageContent

extends Content
Known Direct Subinterfaces
io.github.spannm.jackcess.util.OleBlob.LinkContent, io.github.spannm.jackcess.util.OleBlob.SimplePackageContent, io.github.spannm.jackcess.util.OleBlob.CompoundContent, io.github.spannm.jackcess.util.OleBlob.OtherContent
Known Direct Implementers
io.github.spannm.jackcess.impl.OleUtil.EmbeddedPackageContentImpl

Intermediate sub-interface for Content which has a nested package.

Method Summary

Modifier and TypeMethod and Description
public String
public String
public String
Inherited from io.github.spannm.jackcess.util.OleBlob.Content:
getBlobgetType

Method Detail

getClassNameback to summary
public String getClassName()
getPrettyNameback to summary
public String getPrettyName()
getTypeNameback to summary
public String getTypeName()
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 Summary

Modifier and TypeMethod and Description
public String
public String
public String
Inherited from io.github.spannm.jackcess.util.OleBlob.EmbeddedContent:
getStreamlengthwriteTo
Inherited from io.github.spannm.jackcess.util.OleBlob.PackageContent:
getClassNamegetPrettyNamegetTypeName

Method Detail

getFileNameback to summary
public String getFileName()
getFilePathback to summary
public String getFilePath()
getLocalFilePathback to summary
public String getLocalFilePath()