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-scratchpad-5.2.3.jar?
What Is poi-scratchpad-5.2.3.jar?
✍: FYIcenter.com
poi-scratchpad-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-scratchpad-5.2.3.jar provides support for older versions of Microsoft document files like Word 97, Excel 97, PowerPoint 97, etc.
poi-scratchpad-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-scratchpad-5.2.3.jar Target JDK version: 9 Dependency: poi.jar File name: poi-scratchpad.jar, poi-scratchpad-5.2.3.jar File size: 1897121 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-scratchpad-5.2.3.jar:
⏎ org/apache/poi/hwpf/usermodel/FieldsImpl.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.hwpf.usermodel;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.hwpf.model.FieldDescriptor;
import org.apache.poi.hwpf.model.FieldsDocumentPart;
import org.apache.poi.hwpf.model.FieldsTables;
import org.apache.poi.hwpf.model.PlexOfField;
import org.apache.poi.util.Internal;
/**
* Default implementation of {@link Field}
*/
@Internal
public class FieldsImpl implements Fields
{
/**
* This is port and adaptation of Arrays.binarySearch from Java 6 (Apache
* Harmony).
*/
private static int binarySearch( List<PlexOfField> list,
int startIndex, int endIndex, int requiredStartOffset )
{
checkIndexForBinarySearch( list.size(), startIndex, endIndex );
int low = startIndex, mid = -1, high = endIndex - 1;
while ( low <= high )
{
mid = ( low + high ) >>> 1;
int midStart = list.get( mid ).getFcStart();
if ( midStart == requiredStartOffset )
{
return mid;
}
else if ( midStart < requiredStartOffset )
{
low = mid + 1;
}
else
{
high = mid - 1;
}
}
if ( mid < 0 )
{
int insertPoint = endIndex;
for ( int index = startIndex; index < endIndex; index++ )
{
if ( requiredStartOffset < list.get( index ).getFcStart() )
{
insertPoint = index;
}
}
return -insertPoint - 1;
}
return -mid - 1;
}
private static void checkIndexForBinarySearch( int length, int start,
int end )
{
if ( start > end )
{
throw new IllegalArgumentException();
}
if ( length < end || 0 > start )
{
throw new ArrayIndexOutOfBoundsException();
}
}
private Map<FieldsDocumentPart, Map<Integer, FieldImpl>> _fieldsByOffset;
private PlexOfFieldComparator comparator = new PlexOfFieldComparator();
public FieldsImpl( FieldsTables fieldsTables )
{
_fieldsByOffset = new HashMap<>(
FieldsDocumentPart.values().length);
for ( FieldsDocumentPart part : FieldsDocumentPart.values() )
{
List<PlexOfField> plexOfCps = fieldsTables.getFieldsPLCF( part );
_fieldsByOffset.put( part, parseFieldStructure( plexOfCps ) );
}
}
public Collection<Field> getFields( FieldsDocumentPart part )
{
Map<Integer, FieldImpl> map = _fieldsByOffset.get( part );
if ( map == null || map.isEmpty() )
return Collections.emptySet();
return Collections.unmodifiableCollection( map.values() );
}
public FieldImpl getFieldByStartOffset( FieldsDocumentPart documentPart,
int offset )
{
Map<Integer, FieldImpl> map = _fieldsByOffset.get( documentPart );
if ( map == null || map.isEmpty() )
return null;
return map.get(offset);
}
private Map<Integer, FieldImpl> parseFieldStructure(
List<PlexOfField> plexOfFields )
{
if ( plexOfFields == null || plexOfFields.isEmpty() )
return new HashMap<>();
plexOfFields.sort(comparator);
List<FieldImpl> fields = new ArrayList<>(
plexOfFields.size() / 3 + 1);
parseFieldStructureImpl( plexOfFields, 0, plexOfFields.size(), fields );
HashMap<Integer, FieldImpl> result = new HashMap<>(
fields.size());
for ( FieldImpl field : fields )
{
result.put(field.getFieldStartOffset(), field );
}
return result;
}
@SuppressWarnings("UnnecessaryContinue")
private void parseFieldStructureImpl(List<PlexOfField> plexOfFields,
int startOffsetInclusive, int endOffsetExclusive,
List<FieldImpl> result )
{
int next = startOffsetInclusive;
while ( next < endOffsetExclusive )
{
PlexOfField startPlexOfField = plexOfFields.get( next );
if ( startPlexOfField.getFld().getBoundaryType() != FieldDescriptor.FIELD_BEGIN_MARK )
{
/* Start mark seems to be missing */
next++;
continue;
}
/*
* we have start node. end offset points to next node, separator or
* end
*/
int nextNodePositionInList = binarySearch( plexOfFields, next + 1,
endOffsetExclusive, startPlexOfField.getFcEnd() );
if ( nextNodePositionInList < 0 )
{
/*
* too bad, this start field mark doesn't have corresponding end
* field mark or separator field mark in fields table
*/
next++;
continue;
}
PlexOfField nextPlexOfField = plexOfFields
.get( nextNodePositionInList );
switch ( nextPlexOfField.getFld().getBoundaryType() )
{
case FieldDescriptor.FIELD_SEPARATOR_MARK:
{
int endNodePositionInList = binarySearch( plexOfFields,
nextNodePositionInList, endOffsetExclusive,
nextPlexOfField.getFcEnd() );
if ( endNodePositionInList < 0 )
{
/*
* too bad, this separator field mark doesn't have
* corresponding end field mark in fields table
*/
next++;
continue;
}
PlexOfField endPlexOfField = plexOfFields
.get( endNodePositionInList );
if ( endPlexOfField.getFld().getBoundaryType() != FieldDescriptor.FIELD_END_MARK )
{
/* Not and ending mark */
next++;
continue;
}
FieldImpl field = new FieldImpl( startPlexOfField,
nextPlexOfField, endPlexOfField );
result.add( field );
// adding included fields
if ( startPlexOfField.getFcStart() + 1 < nextPlexOfField
.getFcStart() - 1 )
{
parseFieldStructureImpl( plexOfFields, next + 1,
nextNodePositionInList, result );
}
if ( nextPlexOfField.getFcStart() + 1 < endPlexOfField
.getFcStart() - 1 )
{
parseFieldStructureImpl( plexOfFields,
nextNodePositionInList + 1, endNodePositionInList,
result );
}
next = endNodePositionInList + 1;
break;
}
case FieldDescriptor.FIELD_END_MARK:
{
// we have no separator
FieldImpl field = new FieldImpl( startPlexOfField, null,
nextPlexOfField );
result.add( field );
// adding included fields
if ( startPlexOfField.getFcStart() + 1 < nextPlexOfField
.getFcStart() - 1 )
{
parseFieldStructureImpl( plexOfFields, next + 1,
nextNodePositionInList, result );
}
next = nextNodePositionInList + 1;
break;
}
case FieldDescriptor.FIELD_BEGIN_MARK:
default:
{
/* something is wrong, ignoring this mark along with start mark */
next++;
continue;
}
}
}
}
private static final class PlexOfFieldComparator implements Comparator<PlexOfField>, Serializable {
public int compare( PlexOfField o1, PlexOfField o2 )
{
int thisVal = o1.getFcStart();
int anotherVal = o2.getFcStart();
return Integer.compare(thisVal, anotherVal);
}
}
}
⏎ org/apache/poi/hwpf/usermodel/FieldsImpl.java
Or download all of them as a single archive file:
File name: poi-scratchpad-5.2.3-src.zip File size: 1238744 bytes Release date: 2022-09-09 Download
⇒ What Is poi-examples-5.2.3.jar?
⇐ What Is poi-excelant-5.2.3.jar?
2017-03-22, ≈142🔥, 0💬
Popular Posts:
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...
Apache Log4j API provides the interface that applications should code to and provides the adapter co...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
JDK 11 jrt-fs.jar is the JAR file for JDK 11 JRT-FS (Java RunTime - File System) defined in the "jdk...
JAX-RPC is an API for building Web services and clients that used remote procedure calls (RPC) and X...