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

org.jpedal.io.types.BooleanArray Maven / Gradle / Ivy

/*
 * ===========================================
 * 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@
 *
 * ---------------
 * BooleanArray.java
 * ---------------
 */
package org.jpedal.io.types;

import org.jpedal.io.PdfFileReader;
import org.jpedal.objects.raw.PdfDictionary;
import org.jpedal.objects.raw.PdfObject;

/**
 * @author markee
 */
public class BooleanArray extends Array {

    public BooleanArray(final PdfFileReader pdfFileReader, final int i, final byte[] raw) {
        super(pdfFileReader, i, PdfDictionary.VALUE_IS_BOOLEAN_ARRAY, raw);
    }

    @Override
    void fillArray(final int elementCount, final PdfObject pdfObject) {

        final boolean[] finalByteValues = new boolean[elementCount];
        byte[] data;

        for (int a = 0; a < elementCount; a++) {
            data = valuesRead.get(a);
            finalByteValues[a] = (data.length > 3 && data[0] == 't' && data[1] == 'r' && data[2] == 'u' && data[3] == 'e');
        }

        pdfObject.setBooleanArray(PDFkeyInt, finalByteValues);


    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy