Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/poifs/property/PropertyTable.java
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.poifs.property;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.poifs.common.POIFSBigBlockSize;
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.poifs.filesystem.BATManaged;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSStream;
import org.apache.poi.poifs.storage.HeaderBlock;
import org.apache.poi.util.IOUtils;
import static org.apache.logging.log4j.util.Unbox.box;
/**
* This class embodies the Property Table for a {@link POIFSFileSystem};
* this is basically the directory for all of the documents in the
* filesystem and looks up entries in the filesystem to their
* chain of blocks.
*/
public final class PropertyTable implements BATManaged {
private static final Logger LOG = LogManager.getLogger(PropertyTable.class);
private final HeaderBlock _header_block;
private final List<Property> _properties = new ArrayList<>();
private final POIFSBigBlockSize _bigBigBlockSize;
public PropertyTable(HeaderBlock headerBlock)
{
_header_block = headerBlock;
_bigBigBlockSize = headerBlock.getBigBlockSize();
addProperty(new RootProperty());
}
/**
* reading constructor (used when we've read in a file and we want
* to extract the property table from it). Populates the
* properties thoroughly
*
* @param headerBlock the header block of the file
* @param filesystem the filesystem to read from
*
* @throws IOException if anything goes wrong (which should be
* a result of the input being NFG)
*/
public PropertyTable(final HeaderBlock headerBlock, final POIFSFileSystem filesystem)
throws IOException {
this(
headerBlock,
new POIFSStream(filesystem, headerBlock.getPropertyStart())
);
}
/* only invoked locally and from the junit tests */
PropertyTable(final HeaderBlock headerBlock, final Iterable<ByteBuffer> dataSource)
throws IOException {
_header_block = headerBlock;
_bigBigBlockSize = headerBlock.getBigBlockSize();
for (ByteBuffer bb : dataSource) {
// Turn it into an array
byte[] data;
if (bb.hasArray() && bb.arrayOffset() == 0 &&
bb.array().length == _bigBigBlockSize.getBigBlockSize()) {
data = bb.array();
} else {
data = IOUtils.safelyAllocate(_bigBigBlockSize.getBigBlockSize(), POIFSFileSystem.getMaxRecordLength());
int toRead = data.length;
if (bb.remaining() < _bigBigBlockSize.getBigBlockSize()) {
// Looks to be a truncated block
// This isn't allowed, but some third party created files
// sometimes do this, and we can normally read anyway
LOG.atWarn().log("Short Property Block, {} bytes instead of the expected {}", box(bb.remaining()),box(_bigBigBlockSize.getBigBlockSize()));
toRead = bb.remaining();
}
bb.get(data, 0, toRead);
}
PropertyFactory.convertToProperties(data, _properties);
}
if (_properties.get(0) != null) {
populatePropertyTree((DirectoryProperty) _properties.get(0));
}
}
/**
* Add a property to the list of properties we manage
*
* @param property the new Property to manage
*/
public void addProperty(Property property) {
_properties.add(property);
}
/**
* Remove a property from the list of properties we manage
*
* @param property the Property to be removed
*/
public void removeProperty(final Property property) {
_properties.remove(property);
}
/**
* Get the root property
*
* @return the root property
*/
public RootProperty getRoot() {
// it's always the first element in the List
return ( RootProperty ) _properties.get(0);
}
/**
* Get the start block for the property table
*
* @return start block index
*/
public int getStartBlock() {
return _header_block.getPropertyStart();
}
/**
* Set the start block for this instance
*
* @param index index into the array of BigBlock instances making
* up the filesystem
*/
public void setStartBlock(final int index) {
_header_block.setPropertyStart(index);
}
/**
* Return the number of BigBlock's this instance uses
*
* @return count of BigBlock instances
*/
public int countBlocks() {
long rawSize = _properties.size() * (long)POIFSConstants.PROPERTY_SIZE;
int blkSize = _bigBigBlockSize.getBigBlockSize();
int numBlocks = (int)(rawSize / blkSize);
if ((rawSize % blkSize) != 0) {
numBlocks++;
}
return numBlocks;
}
/**
* Prepare to be written
*/
public void preWrite() {
List<Property> pList = new ArrayList<>();
// give each property its index
int i=0;
for (Property p : _properties) {
// only handle non-null properties
if (p == null) continue;
p.setIndex(i++);
pList.add(p);
}
// prepare each property for writing
for (Property p : pList) p.preWrite();
}
/**
* Writes the properties out into the given low-level stream
*/
public void write(POIFSStream stream) throws IOException {
OutputStream os = stream.getOutputStream();
for(Property property : _properties) {
if(property != null) {
property.writeData(os);
}
}
os.close();
// Update the start position if needed
if(getStartBlock() != stream.getStartBlock()) {
setStartBlock(stream.getStartBlock());
}
}
private void populatePropertyTree(DirectoryProperty root) throws IOException {
int index = root.getChildIndex();
if (!Property.isValidIndex(index)) {
// property has no children
return;
}
final Stack<Property> children = new Stack<>();
children.push(_properties.get(index));
while (!children.empty()) {
Property property = children.pop();
if (property == null) {
// unknown / unsupported / corrupted property, skip
continue;
}
root.addChild(property);
if (property.isDirectory()) {
populatePropertyTree(( DirectoryProperty ) property);
}
index = property.getPreviousChildIndex();
if (isValidIndex(index)) {
children.push(_properties.get(index));
}
index = property.getNextChildIndex();
if (isValidIndex(index)) {
children.push(_properties.get(index));
}
}
}
private boolean isValidIndex(int index) {
if (! Property.isValidIndex(index))
return false;
if (index < 0 || index >= _properties.size()) {
LOG.atWarn().log("Property index {} outside the valid range 0..{}", box(index),box(_properties.size()));
return false;
}
return true;
}
}
⏎ org/apache/poi/poifs/property/PropertyTable.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, ≈338🔥, 0💬
Popular Posts:
maven-compat-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Compact module. The JAR file name may ...
Apache Log4j API provides the interface that applications should code to and provides the adapter co...
JDK 11 java.sql.rowset.jmod is the JMOD file for JDK 11 SQL Rowset module. JDK 11 SQL Rowset module ...
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module. The JAR file name may ...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...