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

com.adobe.agl.impl.UCharacterPropertyReader Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
/**
*******************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation and    *
* others. All Rights Reserved.                                                *
*******************************************************************************
*/

/*
 * File: UCharacterPropertyReader.java
 * ************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * ___________________
 *
 *  Copyright 2012 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/
package com.adobe.agl.impl;



import java.io.InputStream;
import java.io.DataInputStream;
import java.io.IOException;
import com.adobe.agl.util.VersionInfo;

/**
* 

Internal reader class for ICU data file uprops.icu containing * Unicode codepoint data.

*

This class simply reads uprops.icu, authenticates that it is a valid * ICU data file and split its contents up into blocks of data for use in * com.adobe.agl.impl.UCharacterProperty. *

*

uprops.icu which is in big-endian format is jared together with this * package.

* * Unicode character properties file format see * (ICU4C)/source/tools/genprops/store.c * * @author Syn Wee Quek * @since release 2.1, February 1st 2002 */ final class UCharacterPropertyReader implements ICUBinary.Authenticate { // public methods ---------------------------------------------------- public boolean isDataVersionAcceptable(byte version[]) { return version[0] == DATA_FORMAT_VERSION_[0] && version[2] == DATA_FORMAT_VERSION_[2] && version[3] == DATA_FORMAT_VERSION_[3]; } // protected constructor --------------------------------------------- /** *

Protected constructor.

* @param inputStream ICU uprop.dat file input stream * @exception IOException throw if data file fails authentication */ protected UCharacterPropertyReader(InputStream inputStream) throws IOException { m_unicodeVersion_ = ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_, this); m_dataInputStream_ = new DataInputStream(inputStream); } // protected methods ------------------------------------------------- /** *

Reads uprops.icu, parse it into blocks of data to be stored in * UCharacterProperty.

0) { // reads the additional property block ucharppty.m_additionalTrie_ = new CharTrie(m_dataInputStream_, null); // additional properties size = m_reservedOffset_ - m_additionalVectorsOffset_; ucharppty.m_additionalVectors_ = new int[size]; for (int i = 0; i < size; i ++) { ucharppty.m_additionalVectors_[i] = m_dataInputStream_.readInt(); } } m_dataInputStream_.close(); ucharppty.m_additionalColumnsCount_ = m_additionalColumnsCount_; ucharppty.m_unicodeVersion_ = VersionInfo.getInstance( (int)m_unicodeVersion_[0], (int)m_unicodeVersion_[1], (int)m_unicodeVersion_[2], (int)m_unicodeVersion_[3]); } // private variables ------------------------------------------------- /** * Index size */ private static final int INDEX_SIZE_ = 16; /** * ICU data file input stream */ private DataInputStream m_dataInputStream_; /** * Offset information in the indexes. */ private int m_propertyOffset_; private int m_exceptionOffset_; private int m_caseOffset_; private int m_additionalOffset_; private int m_additionalVectorsOffset_; private int m_additionalColumnsCount_; private int m_reservedOffset_; private byte m_unicodeVersion_[]; /** * Data format "UPro". */ private static final byte DATA_FORMAT_ID_[] = {(byte)0x55, (byte)0x50, (byte)0x72, (byte)0x6F}; /** * Format version; this code works with all versions with the same major * version number and the same Trie bit distribution. */ private static final byte DATA_FORMAT_VERSION_[] = {(byte)0x5, (byte)0, (byte)Trie.INDEX_STAGE_1_SHIFT_, (byte)Trie.INDEX_STAGE_2_SHIFT_}; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy