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

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:


/* ====================================================================
   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


   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */

package org.apache.poi.hemf.record.emfplus;

import static org.apache.poi.util.GenericRecordUtil.getBitsAsString;

import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import org.apache.poi.common.usermodel.GenericRecord;
import org.apache.poi.hemf.draw.HemfDrawProperties;
import org.apache.poi.hemf.draw.HemfGraphics;
import org.apache.poi.hemf.record.emfplus.HemfPlusDraw.EmfPlusCompressed;
import org.apache.poi.hemf.record.emfplus.HemfPlusDraw.EmfPlusRelativePosition;
import org.apache.poi.hemf.record.emfplus.HemfPlusHeader.EmfPlusGraphicsVersion;
import org.apache.poi.hemf.record.emfplus.HemfPlusObject.EmfPlusObjectData;
import org.apache.poi.hemf.record.emfplus.HemfPlusObject.EmfPlusObjectType;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LittleEndianInputStream;

public class HemfPlusPath {

    /** The PathPointType enumeration defines types of points on a graphics path. */
    public enum EmfPlusPathPointType {
        /** Specifies that the point is the starting point of a path. */
        /** Specifies that the point is one of the two endpoints of a line. */
        // not defined
        /** Specifies that the point is an endpoint or control point of a cubic Bezier curve */

    public static class EmfPlusPath implements EmfPlusObjectData, EmfPlusCompressed, EmfPlusRelativePosition {
         * If set, the point types in the PathPointTypes array are specified by EmfPlusPathPointTypeRLE objects,
         * which use run-length encoding (RLE) compression, and/or EmfPlusPathPointType objects.
         * If clear, the point types in the PathPointTypes array are specified by EmfPlusPathPointType objects.
        private static final BitField RLE_COMPRESSED = BitFieldFactory.getInstance(0x00001000);

        /** Specifies that a line segment that passes through the point is dashed. */
        private static final BitField POINT_TYPE_DASHED = BitFieldFactory.getInstance(0x10);

        /** Specifies that the point is a position marker. */
        private static final BitField POINT_TYPE_MARKER = BitFieldFactory.getInstance(0x20);

        /** Specifies that the point is the endpoint of a subpath. */
        private static final BitField POINT_TYPE_CLOSE = BitFieldFactory.getInstance(0x80);

        private static final BitField POINT_TYPE_ENUM = BitFieldFactory.getInstance(0x0F);

        private static final BitField POINT_RLE_BEZIER = BitFieldFactory.getInstance(0x80);

        private static final BitField POINT_RLE_COUNT = BitFieldFactory.getInstance(0x3F);

        private static final int[] FLAGS_MASKS = { 0x0800, 0x1000, 0x4000 };
        private static final String[] FLAGS_NAMES = { "RELATIVE_POSITION", "RLE_COMPRESSED", "FORMAT_COMPRESSED" };

        private static final int[] TYPE_MASKS = { 0x10, 0x20, 0x80 };
        private static final String[] TYPE_NAMES = { "DASHED", "MARKER", "CLOSE" };

        private final EmfPlusGraphicsVersion graphicsVersion = new EmfPlusGraphicsVersion();
        private int pointFlags;
        private Point2D[] pathPoints;
        private byte[] pointTypes;

        public long init(LittleEndianInputStream leis, long dataSize, EmfPlusObjectType objectType, int flags) throws IOException {
            long size = graphicsVersion.init(leis);

            // A 32-bit unsigned integer that specifies the number of points and associated point types that
            // are defined by this object.
            int pointCount = leis.readInt();

            // A 16-bit unsigned integer that specifies how to interpret the points
            // and associated point types that are defined by this object.
            pointFlags = leis.readShort();

            size += 2* LittleEndianConsts.INT_SIZE;

            BiFunction<LittleEndianInputStream,Point2D,Integer> readPoint;

            if (isRelativePosition()) {
                readPoint = HemfPlusDraw::readPointR;
            } else if (isCompressed()) {
                readPoint = HemfPlusDraw::readPointS;
            } else {
                readPoint = HemfPlusDraw::readPointF;

            pathPoints = new Point2D[pointCount];
            for (int i=0; i<pointCount; i++) {
                pathPoints[i] = new Point2D.Double();
                size += readPoint.apply(leis,pathPoints[i]);

            pointTypes = new byte[pointCount];
            final boolean isRLE = RLE_COMPRESSED.isSet(pointFlags);
            if (isRLE) {
                for (int i=0, rleCount; i<pointCount; i+=rleCount, size+=2) {
                    rleCount = POINT_RLE_COUNT.getValue(leis.readByte());
                    Arrays.fill(pointTypes, pointCount, pointCount+rleCount, leis.readByte());
            } else {
                size += pointCount;

            int padding = (int)((4 - (size % 4)) % 4);
            size += padding;

            return size;

        public EmfPlusGraphicsVersion getGraphicsVersion() {
            return graphicsVersion;

        public boolean isPointDashed(int index) {
            return POINT_TYPE_DASHED.isSet(pointTypes[index]);

        public boolean isPointMarker(int index) {
            return POINT_TYPE_MARKER.isSet(pointTypes[index]);

        public boolean isPointClosed(int index) {
            return POINT_TYPE_CLOSE.isSet(pointTypes[index]);

        public EmfPlusPathPointType getPointType(int index) {
            return EmfPlusPathPointType.values()[POINT_TYPE_ENUM.getValue(pointTypes[index])];

        public int getFlags() {
            return pointFlags;

        public Point2D getPoint(int index) {
            return pathPoints[index];

        public void applyObject(HemfGraphics ctx, List<? extends EmfPlusObjectData> continuedObjectData) {
            HemfDrawProperties prop = ctx.getProperties();

        public Path2D getPath() {
            return getPath(Path2D.WIND_NON_ZERO);

        public Path2D getPath(int windingRule) {
            Path2D path = new Path2D.Double(windingRule);
            for (int idx=0; idx < pathPoints.length; idx++) {
                Point2D p1 = pathPoints[idx];
                switch (getPointType(idx)) {
                    case START:
                        path.moveTo(p1.getX(), p1.getY());
                    case LINE:
                        path.lineTo(p1.getX(), p1.getY());
                    case BEZIER: {
                        Point2D p2 = pathPoints[++idx];
                        Point2D p3 = pathPoints[++idx];
                        path.curveTo(p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY());
                if (isPointClosed(idx)) {
            return path;

        public Enum getGenericRecordType() {
            return EmfPlusObjectType.PATH;

        public Map<String, Supplier<?>> getGenericProperties() {
            return GenericRecordUtil.getGenericProperties(
                "graphicsVersion", this::getGraphicsVersion,
                "flags", getBitsAsString(this::getFlags, FLAGS_MASKS, FLAGS_NAMES),
                "points", this::getGenericPoints

        private List<GenericRecord> getGenericPoints() {
            return IntStream.range(0, pathPoints.length).

        private GenericRecord getGenericPoint(final int idx) {
            return () -> GenericRecordUtil.getGenericProperties(
                "flags", getBitsAsString(() -> pointTypes[idx], TYPE_MASKS, TYPE_NAMES),
                "type", () -> getPointType(idx),
                "point", () -> getPoint(idx)


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


What Is poi-examples-5.2.3.jar?

What Is poi-excelant-5.2.3.jar?

Downloading and Installing Apache POI Java Library

⇑⇑ FAQ for Apache POI (Poor Obfuscation Implementation)

2017-03-22, 5156👍, 0💬