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

org.lockss.pdf.PdfToken Maven / Gradle / Ivy

The newest version!
/*
 * $Id$
 */

/*

Copyright (c) 2000-2012 Board of Trustees of Leland Stanford Jr. University,
all rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of Stanford University shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Stanford University.

*/

package org.lockss.pdf;

import java.util.*;

/**
 * 

* Abstraction for a PDF token (PDF data type). *

*

* This API defines a mapping between high-level PDF tokens ({@link * PdfToken}) and their external representation (Java types). This * interface defines characterization and external downcast; upcast * is defined in the sister interface {@link PdfTokenFactory}. *

*

* The naming used in the methods of this interface reflects the PDF * type being represented, even if it seemingly clashes in name with * the Java type it is represented by (e.g. {@link #getInteger()} * returns a long, because not all PDF integers can * fit into a Java int). *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PDF typeExternal representationCharacterizationExternal downcast
PDF array{@link List}<{@link PdfToken}>{@link #isArray()}{@link #getArray()}
PDF booleanboolean{@link #isBoolean()}{@link #getBoolean()}
PDF dictionary{@link Map}<{@link String}, {@link PdfToken}>{@link #isDictionary()}{@link #getDictionary()}
PDF floatfloat{@link #isFloat()}{@link #getFloat()}
PDF integerlong{@link #isInteger()}{@link #getInteger()}
PDF name{@link String}{@link #isName()}{@link #getName()}
PDF nullnull{@link #isNull()}n/a
PDF object{@link PdfToken}{@link #isObject()}{@link #getObject()}
PDF operator{@link String}{@link #isOperator()}{@link #getOperator()}
PDF string{@link String}{@link #isString()}{@link #getString()}
*

* This interface does not currently provide a representation for the * PDF 'stream' type. This may change in a future version. *

* @author Thib Guicherd-Callin * @since 1.56 * @see PdfTokenFactory */ public interface PdfToken { /** *

* If {@link #isArray()} is true, downcasts this token to its * external representation, otherwise the behavior is undefined. *

* @return A list of PDF tokens. * @since 1.56 */ List getArray(); /** *

* If {@link #isBoolean()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A boolean value. * @since 1.56 */ boolean getBoolean(); /** *

* If {@link #isDictionary()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A map from strings to PDF tokens. * @since 1.56 */ Map getDictionary(); /** *

* If {@link #isFloat()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A float value. * @since 1.56 */ float getFloat(); /** *

* If {@link #isInteger()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A long value. * @since 1.56 */ long getInteger(); /** *

* If {@link #isString()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A {@link String} value. * @since 1.56 */ String getName(); /** *

* If {@link #isObject()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A {@link PdfToken} value. * @since 1.56.3 */ PdfToken getObject(); /** *

* If {@link #isOperator()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A {@link String} value. * @since 1.56 */ String getOperator(); /** *

* If {@link #isString()} is true, downcasts this token to * its external representation, otherwise the behavior is undefined. *

* @return A {@link String} value. * @since 1.56 */ String getString(); /** *

* Determines if this token is a PDF array. * @return true if and only if this token is a PDF * array. * @since 1.56 */ boolean isArray(); /** *

* Determines if this token is a PDF boolean. * @return true if and only if this token is a PDF * boolean. * @since 1.56 */ boolean isBoolean(); /** *

* Determines if this token is a PDF dictionary. * @return true if and only if this token is a PDF * dictionary. * @since 1.56 */ boolean isDictionary(); /** *

* Determines if this token is a PDF float. * @return true if and only if this token is a PDF * float. * @since 1.56 */ boolean isFloat(); /** *

* Determines if this token is a PDF integer. * @return true if and only if this token is a PDF * integer. * @since 1.56 */ boolean isInteger(); /** *

* Determines if this token is a PDF name. * @return true if and only if this token is a PDF * name. * @since 1.56 */ boolean isName(); /** *

* Determines if this token is a PDF null object. * @return true if and only if this token is a PDF * null object. * @since 1.56 */ boolean isNull(); /** *

* Determines if this token is a PDF object. *

* @return true if and only if this token is a PDF * object. * @since 1.56.3 */ boolean isObject(); /** *

* Determines if this token is a PDF operator. * @return true if and only if this token is a PDF * operator. * @since 1.56 */ boolean isOperator(); /** *

* Determines if this token is a PDF string. * @return true if and only if this token is a PDF * string. * @since 1.56 */ boolean isString(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy