Interface OleBlob
-
- All Superinterfaces:
AutoCloseable,Blob,Closeable
public interface OleBlob extends Blob, Closeable
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 theOleBlob.ContentTypeof the Content.Once an OleBlob is no longer useful, it should be closed using
Blob.free()orCloseable.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.Builderand 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(); } }- Author:
- James Ahlborn
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classOleBlob.BuilderBuilder style class for constructing an OleBlob.static interfaceOleBlob.CompoundContentSub-interface for Content which has theOleBlob.ContentType.COMPOUND_STORAGEtype.static interfaceOleBlob.Contentstatic classOleBlob.ContentTypeEnum describing the types of blob contents which are currently supported/understoodstatic interfaceOleBlob.EmbeddedContentIntermediate sub-interface for Content which has embedded content.static interfaceOleBlob.LinkContentSub-interface for Content which has theOleBlob.ContentType.LINKtype.static interfaceOleBlob.OtherContentSub-interface for Content which has theOleBlob.ContentType.OTHERtype.static interfaceOleBlob.PackageContentIntermediate sub-interface for Content which has a nested package.static interfaceOleBlob.SimplePackageContentSub-interface for Content which has theOleBlob.ContentType.SIMPLE_PACKAGEtype.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OleBlob.ContentgetContent()Returns the decoded form of the blob contents, if understandable.voidwriteTo(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
-
-
-
-
Method Detail
-
writeTo
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- stream to which the blob will be written- Throws:
IOException
-
getContent
OleBlob.Content getContent() throws IOException
Returns the decoded form of the blob contents, if understandable.- Throws:
IOException
-
-