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/DirectoryProperty.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.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Spliterator;
/**
* Directory property
*/
public class DirectoryProperty extends Property implements Parent, Iterable<Property> {
/** List of Property instances */
private final List<Property> _children = new ArrayList<>();
/** set of children's names */
private final Set<String> _children_names = new HashSet<>();
/**
* Default constructor
*
* @param name the name of the directory
*/
public DirectoryProperty(String name)
{
super();
setName(name);
setSize(0);
setPropertyType(PropertyConstants.DIRECTORY_TYPE);
setStartBlock(0);
setNodeColor(_NODE_BLACK); // simplification
}
/**
* reader constructor
*
* @param index index number
* @param array byte data
* @param offset offset into byte data
*/
protected DirectoryProperty(final int index, final byte [] array,
final int offset)
{
super(index, array, offset);
}
/**
* Change a Property's name
*
* @param property the Property whose name is being changed
* @param newName the new name for the Property
*
* @return true if the name change could be made, else false
*/
public boolean changeName(Property property, String newName)
{
boolean result;
String oldName = property.getName();
property.setName(newName);
String cleanNewName = property.getName();
if (_children_names.contains(cleanNewName))
{
// revert the change
property.setName(oldName);
result = false;
}
else
{
_children_names.add(cleanNewName);
_children_names.remove(oldName);
result = true;
}
return result;
}
/**
* Delete a Property
*
* @param property the Property being deleted
*
* @return true if the Property could be deleted, else false
*/
public boolean deleteChild(Property property)
{
boolean result = _children.remove(property);
if (result)
{
_children_names.remove(property.getName());
}
return result;
}
public static class PropertyComparator implements Comparator<Property>, Serializable {
/**
* compare method. Assumes both parameters are non-null
* instances of Property. One property is less than another if
* its name is shorter than the other property's name. If the
* names are the same length, the property whose name comes
* before the other property's name, alphabetically, is less
* than the other property.
*
* @param o1 first object to compare, better be a Property
* @param o2 second object to compare, better be a Property
*
* @return negative value if o1 < o2,
* zero if o1 == o2,
* positive value if o1 > o2.
*/
public int compare(Property o1, Property o2)
{
String VBA_PROJECT = "_VBA_PROJECT";
String name1 = o1.getName();
String name2 = o2.getName();
int result = name1.length() - name2.length();
if (result == 0)
{
// _VBA_PROJECT, it seems, will always come last
if (name1.compareTo(VBA_PROJECT) == 0)
result = 1;
else if (name2.compareTo(VBA_PROJECT) == 0)
result = -1;
else
{
if (name1.startsWith("__") && name2.startsWith("__"))
{
// Betweeen __SRP_0 and __SRP_1 just sort as normal
result = name1.compareToIgnoreCase(name2);
}
else if (name1.startsWith("__"))
{
// If only name1 is __XXX then this will be placed after name2
result = 1;
}
else if (name2.startsWith("__"))
{
// If only name2 is __XXX then this will be placed after name1
result = -1;
}
else
// result = name1.compareTo(name2);
// The default case is to sort names ignoring case
result = name1.compareToIgnoreCase(name2);
}
}
return result;
}
}
/**
* @return true if a directory type Property
*/
public boolean isDirectory()
{
return true;
}
/**
* Perform whatever activities need to be performed prior to
* writing
*/
protected void preWrite()
{
if (!_children.isEmpty())
{
Property[] children = _children.toArray(new Property[ 0 ]);
Arrays.sort(children, new PropertyComparator());
int midpoint = children.length / 2;
setChildProperty(children[ midpoint ].getIndex());
children[ 0 ].setPreviousChild(null);
children[ 0 ].setNextChild(null);
for (int j = 1; j < midpoint; j++)
{
children[ j ].setPreviousChild(children[ j - 1 ]);
children[ j ].setNextChild(null);
}
if (midpoint != 0)
{
children[ midpoint ]
.setPreviousChild(children[ midpoint - 1 ]);
}
if (midpoint != (children.length - 1))
{
children[ midpoint ].setNextChild(children[ midpoint + 1 ]);
for (int j = midpoint + 1; j < children.length - 1; j++)
{
children[ j ].setPreviousChild(null);
children[ j ].setNextChild(children[ j + 1 ]);
}
children[ children.length - 1 ].setPreviousChild(null);
children[ children.length - 1 ].setNextChild(null);
}
else
{
children[ midpoint ].setNextChild(null);
}
}
}
/**
* Get an iterator over the children of this Parent; all elements
* are instances of Property.
*
* @return Iterator of children; may refer to an empty collection
*/
public Iterator<Property> getChildren()
{
return _children.iterator();
}
/**
* Get an iterator over the children of this Parent, alias for
* {@link #getChildren()} which supports foreach use
*/
public Iterator<Property> iterator() {
return getChildren();
}
/**
* Get a spliterator over the children of this Parent; all elements
* are instances of Property.
*
* @return Spliterator of children; may refer to an empty collection
*
* @since POI 5.2.0
*/
@Override
public Spliterator<Property> spliterator() {
return _children.spliterator();
}
/**
* Add a new child to the collection of children
*
* @param property the new child to be added; must not be null
*
* @throws IOException if we already have a child with the same
* name
*/
public void addChild(final Property property)
throws IOException
{
String name = property.getName();
if (_children_names.contains(name))
{
throw new IOException("Duplicate name \"" + name + "\"");
}
_children_names.add(name);
_children.add(property);
}
}
⏎ org/apache/poi/poifs/property/DirectoryProperty.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, ≈311🔥, 0💬
Popular Posts:
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Jav...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
JBrowser Source Code Files are provided in the source package file. You can download JBrowser source...