All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpedal.objects.PageLookup Maven / Gradle / Ivy

There is a newer version: 7.15.25
Show newest version
/*
 * ===========================================
 * Java Pdf Extraction Decoding Access Library
 * ===========================================
 *
 * Project Info:  http://www.idrsolutions.com
 * Help section for developers at http://www.idrsolutions.com/support/
 *
 * (C) Copyright 1997-2017 IDRsolutions and Contributors.
 *
 * This file is part of JPedal/JPDF2HTML5
 *
 @LICENSE@
 *
 * ---------------
 * PageLookup.java
 * ---------------
 */
package org.jpedal.objects;

import java.util.HashMap;
import java.util.Map;

/**
 * allow us to lookup pages
 */
public class PageLookup {

    /**
     * holds pdf id (ie 4 0 R) which stores each object in reverse so we can lookup
     */
    private Map pageLookup = new HashMap();

    /**
     * used to work out page id for the object (returns -1 if no value found)
     */
    public int convertObjectToPageNumber(final String offset) {

        final Integer value = pageLookup.get(offset);

        if (value == null) {
            return -1;
        } else {
            return value;
        }


    }

    /**
     * The pageLookup to set.
     */
    public void put(final String key, final int value) {
        pageLookup.put(key, value);

    }

    public void dispose() {

        if (pageLookup != null) {
            pageLookup.clear();
        }
        pageLookup = null;

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy