org.apache.poi.poifs.filesystem
Class Ole10Native

java.lang.Object
  extended by org.apache.poi.poifs.filesystem.Ole10Native

public class Ole10Native
extends java.lang.Object

Represents an Ole10Native record which is wrapped around certain binary files being embedded in OLE2 documents.

Author:
Rainer Schwarze

Field Summary
static java.lang.String OLE10_NATIVE
           
 
Constructor Summary
Ole10Native(byte[] data, int offset)
          Creates an instance and fills the fields based on the data in the given buffer.
Ole10Native(byte[] data, int offset, boolean plain)
          Creates an instance and fills the fields based on the data in the given buffer.
 
Method Summary
static Ole10Native createFromEmbeddedOleObject(DirectoryNode directory)
          Creates an instance of this class from an embedded OLE Object.
static Ole10Native createFromEmbeddedOleObject(POIFSFileSystem poifs)
          Creates an instance of this class from an embedded OLE Object.
 java.lang.String getCommand()
          Returns the command field - usually the name of the file being embedded including the full path, may be a command specified during embedding the file.
 byte[] getDataBuffer()
          Returns the buffer containing the embedded file's data, or null if no data was embedded.
 int getDataSize()
          Returns the size of the embedded file.
 java.lang.String getFileName()
          Returns the fileName field - usually the name of the file being embedded including the full path.
 short getFlags1()
          Returns flags1 - currently unknown - usually 0x0002.
 short getFlags2()
          Returns flags2 - currently unknown - mostly 0x0000.
 short getFlags3()
          Returns the flags3 - currently unknown.
 java.lang.String getLabel()
          Returns the label field - usually the name of the file (without directory) but probably may be any name specified during packaging/embedding the data.
 int getTotalSize()
          Returns the value of the totalSize field - the total length of the structure is totalSize + 4 (value of this field + size of this field).
 byte[] getUnknown1()
          Returns unknown1 field - currently unknown.
 byte[] getUnknown2()
          Returns the unknown2 field - currently being a byte[3] - mostly {0, 0, 0}.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OLE10_NATIVE

public static final java.lang.String OLE10_NATIVE
See Also:
Constant Field Values
Constructor Detail

Ole10Native

public Ole10Native(byte[] data,
                   int offset)
            throws Ole10NativeException
Creates an instance and fills the fields based on the data in the given buffer.

Parameters:
data - The buffer containing the Ole10Native record
offset - The start offset of the record in the buffer
Throws:
Ole10NativeException - on invalid or unexcepted data format

Ole10Native

public Ole10Native(byte[] data,
                   int offset,
                   boolean plain)
            throws Ole10NativeException
Creates an instance and fills the fields based on the data in the given buffer.

Parameters:
data - The buffer containing the Ole10Native record
offset - The start offset of the record in the buffer
plain - Specified 'plain' format without filename
Throws:
Ole10NativeException - on invalid or unexcepted data format
Method Detail

createFromEmbeddedOleObject

public static Ole10Native createFromEmbeddedOleObject(POIFSFileSystem poifs)
                                               throws java.io.IOException,
                                                      Ole10NativeException
Creates an instance of this class from an embedded OLE Object. The OLE Object is expected to include a stream "{01}Ole10Native" which contains the actual data relevant for this class.

Parameters:
poifs - POI Filesystem object
Returns:
Returns an instance of this class
Throws:
java.io.IOException - on IO error
Ole10NativeException - on invalid or unexcepted data format

createFromEmbeddedOleObject

public static Ole10Native createFromEmbeddedOleObject(DirectoryNode directory)
                                               throws java.io.IOException,
                                                      Ole10NativeException
Creates an instance of this class from an embedded OLE Object. The OLE Object is expected to include a stream "{01}Ole10Native" which contains the actual data relevant for this class.

Parameters:
directory - POI Filesystem object
Returns:
Returns an instance of this class
Throws:
java.io.IOException - on IO error
Ole10NativeException - on invalid or unexcepted data format

getTotalSize

public int getTotalSize()
Returns the value of the totalSize field - the total length of the structure is totalSize + 4 (value of this field + size of this field).

Returns:
the totalSize

getFlags1

public short getFlags1()
Returns flags1 - currently unknown - usually 0x0002.

Returns:
the flags1

getLabel

public java.lang.String getLabel()
Returns the label field - usually the name of the file (without directory) but probably may be any name specified during packaging/embedding the data.

Returns:
the label

getFileName

public java.lang.String getFileName()
Returns the fileName field - usually the name of the file being embedded including the full path.

Returns:
the fileName

getFlags2

public short getFlags2()
Returns flags2 - currently unknown - mostly 0x0000.

Returns:
the flags2

getUnknown1

public byte[] getUnknown1()
Returns unknown1 field - currently unknown.

Returns:
the unknown1

getUnknown2

public byte[] getUnknown2()
Returns the unknown2 field - currently being a byte[3] - mostly {0, 0, 0}.

Returns:
the unknown2

getCommand

public java.lang.String getCommand()
Returns the command field - usually the name of the file being embedded including the full path, may be a command specified during embedding the file.

Returns:
the command

getDataSize

public int getDataSize()
Returns the size of the embedded file. If the size is 0 (zero), no data has been embedded. To be sure, that no data has been embedded, check whether getDataBuffer() returns null.

Returns:
the dataSize

getDataBuffer

public byte[] getDataBuffer()
Returns the buffer containing the embedded file's data, or null if no data was embedded. Note that an embedding may provide information about the data, but the actual data is not included. (So label, filename etc. are available, but this method returns null.)

Returns:
the dataBuffer

getFlags3

public short getFlags3()
Returns the flags3 - currently unknown.

Returns:
the flags3


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.