本文整理汇总了Java中org.apache.poi.poifs.filesystem.DocumentEntry.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentEntry.getSize方法的具体用法?Java DocumentEntry.getSize怎么用?Java DocumentEntry.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.poifs.filesystem.DocumentEntry
的用法示例。
在下文中一共展示了DocumentEntry.getSize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initTableStream
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Initializes the table stream
*
* @throws IOException
*/
private void initTableStream() throws IOException
{
String tablename = null;
if(_fib.isFWhichTblStm())
{
tablename="1Table";
}
else
{
tablename="0Table";
}
DocumentEntry tableEntry = (DocumentEntry)_filesystem.getRoot().getEntry(tablename);
//load the table stream into a buffer
int size = tableEntry.getSize();
_tableBuffer = new byte[size];
_filesystem.createDocumentInputStream(tablename).read(_tableBuffer);
}
示例2: getMessagePropertyFromDocumentEntry
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Reads a property from a document entry and puts it's type and data to a {@link OutlookMessageProperty} object.
*
* @param de The {@link DocumentEntry} to be read.
* @return An object holding the type and data of the read property.
* @throws IOException In case the property could not be parsed.
*/
private OutlookMessageProperty getMessagePropertyFromDocumentEntry(final DocumentEntry de)
throws IOException {
// analyze the document entry
// (i.e., get class and data type)
final OutlookFieldInformation info = analyzeDocumentEntry(de);
// create a Java object from the data provided
// by the input stream. depending on the field
// information, either a String or a byte[] will
// be returned. other datatypes are not yet supported
final Object data = getData(de, info);
LOGGER.trace(" Document data: {}", data);
return new OutlookMessageProperty(info.getClazz(), data, de.getSize());
}
示例3: readFIB
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Extracts the main document stream from the POI file then hands off to other
* functions that parse other areas.
*
* @throws IOException
*/
private void readFIB() throws IOException
{
//get the main document stream
DocumentEntry headerProps =
(DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
//I call it the header but its also the main document stream
_header = new byte[headerProps.getSize()];
filesystem.createDocumentInputStream("WordDocument").read(_header);
//Get the information we need from the header
int info = LittleEndian.getShort(_header, 0xa);
_fcMin = LittleEndian.getInt(_header, 0x18);
_ccpText = LittleEndian.getInt(_header, 0x4c);
_ccpFtn = LittleEndian.getInt(_header, 0x50);
int charPLC = LittleEndian.getInt(_header, 0xfa);
int charPlcSize = LittleEndian.getInt(_header, 0xfe);
int parPLC = LittleEndian.getInt(_header, 0x102);
int parPlcSize = LittleEndian.getInt(_header, 0x106);
boolean useTable1 = (info & 0x200) != 0;
//process the text and formatting properties
processComplexFile(useTable1, charPLC, charPlcSize, parPLC, parPlcSize);
}
示例4: HDFObjectFactory
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/** Creates a new instance of HDFObjectFactory
*
* @param istream The InputStream that is the Word document
*
*/
protected HDFObjectFactory(InputStream istream, HDFLowLevelParsingListener l) throws IOException
{
if (l == null)
{
_listener = new HDFObjectModel();
}
else
{
_listener = l;
}
//do Ole stuff
_filesystem = new POIFSFileSystem(istream);
DocumentEntry headerProps =
(DocumentEntry)_filesystem.getRoot().getEntry("WordDocument");
_mainDocument = new byte[headerProps.getSize()];
_filesystem.createDocumentInputStream("WordDocument").read(_mainDocument);
_fib = new FileInformationBlock(_mainDocument);
initTableStream();
initTextPieces();
initFormattingProperties();
}
示例5: getData
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
private static byte[] getData(DirectoryNode dir, String name) throws IOException {
DocumentEntry docProps =
(DocumentEntry)dir.getEntry(name);
// Grab the document stream
byte[] d = new byte[docProps.getSize()];
dir.createDocumentInputStream(name).read(d);
// All done
return d;
}
示例6: HDGFDiagram
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
public HDGFDiagram(DirectoryNode dir) throws IOException {
super(dir);
DocumentEntry docProps =
(DocumentEntry)dir.getEntry("VisioDocument");
// Grab the document stream
_docstream = new byte[docProps.getSize()];
dir.createDocumentInputStream("VisioDocument").read(_docstream);
// Check it's really visio
String typeString = new String(_docstream, 0, 20);
if(! typeString.equals(VISIO_HEADER)) {
throw new IllegalArgumentException("Wasn't a valid visio document, started with " + typeString);
}
// Grab the version number, 0x1a -> 0x1b
version = LittleEndian.getShort(_docstream, 0x1a);
// Grab the document size, 0x1c -> 0x1f
docSize = LittleEndian.getUInt(_docstream, 0x1c);
// ??? 0x20 -> 0x23
// Create the Chunk+Pointer Factories for the document version
ptrFactory = new PointerFactory(version);
chunkFactory = new ChunkFactory(version);
// Grab the pointer to the trailer
trailerPointer = ptrFactory.createPointer(_docstream, 0x24);
// Now grab the trailer
trailer = (TrailerStream)
Stream.createStream(trailerPointer, _docstream, chunkFactory, ptrFactory);
// Finally, find all our streams
trailer.findChildren(_docstream);
}
示例7: SlideShowDumper
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Constructs a Powerpoint dump from a POIFS Filesystem. Parses the
* document and dumps out the contents
*
* @param filesystem the POIFS FileSystem to read from
* @throws IOException if there is a problem while parsing the document.
*/
public SlideShowDumper(POIFSFileSystem filesystem) throws IOException
{
this.filesystem = filesystem;
// Get the main document stream
DocumentEntry docProps =
(DocumentEntry)filesystem.getRoot().getEntry("PowerPoint Document");
// Grab the document stream
_docstream = new byte[docProps.getSize()];
filesystem.createDocumentInputStream("PowerPoint Document").read(_docstream);
}
示例8: QuickButCruddyTextExtractor
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Creates an extractor from a POIFS Filesystem
* @param poifs
*/
public QuickButCruddyTextExtractor(POIFSFileSystem poifs) throws IOException {
fs = poifs;
// Find the PowerPoint bit, and get out the bytes
DocumentEntry docProps =
(DocumentEntry)fs.getRoot().getEntry("PowerPoint Document");
pptContents = new byte[docProps.getSize()];
fs.createDocumentInputStream("PowerPoint Document").read(pptContents);
}
示例9: readPowerPointStream
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
/**
* Extracts the main PowerPoint document stream from the
* POI file, ready to be passed
*
* @throws IOException
*/
private void readPowerPointStream() throws IOException
{
// Get the main document stream
DocumentEntry docProps =
(DocumentEntry)directory.getEntry("PowerPoint Document");
// Grab the document stream
_docstream = new byte[docProps.getSize()];
directory.createDocumentInputStream("PowerPoint Document").read(_docstream);
}
示例10: getTypes
import org.apache.poi.poifs.filesystem.DocumentEntry; //导入方法依赖的package包/类
public static List getTypes(InputStream istream) throws IOException
{
List results = new ArrayList(1);
//do Ole stuff
POIFSFileSystem filesystem = new POIFSFileSystem(istream);
DocumentEntry headerProps =
(DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
byte[] mainDocument = new byte[headerProps.getSize()];
filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
FileInformationBlock fib = new FileInformationBlock(mainDocument);
results.add(fib);
return results;
}