Class UCharacterNameReader

  • All Implemented Interfaces:
    ICUBinary.Authenticate

    final class UCharacterNameReader
    extends java.lang.Object
    implements ICUBinary.Authenticate

    Internal reader class for ICU data file uname.dat containing Unicode codepoint name data.

    This class simply reads unames.icu, authenticates that it is a valid ICU data file and split its contents up into blocks of data for use in com.ibm.icu.impl.UCharacterName.

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

    Since:
    release 2.1, February 1st 2002
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected UCharacterNameReader​(java.nio.ByteBuffer bytes)
      Protected constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean authenticate​(byte[] dataformatid, byte[] dataformatversion)
      Checking the file for the correct format.
      boolean isDataVersionAcceptable​(byte[] version)
      Method used in ICUBinary.readHeader() to provide data format authentication.
      protected void read​(UCharacterName data)
      Read and break up the stream of data passed in as arguments and fills up UCharacterName.
      private UCharacterName.AlgorithmName readAlg()
      Reads an individual record of AlgorithmNames
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_byteBuffer_

        private java.nio.ByteBuffer m_byteBuffer_
        Byte buffer for names
      • GROUP_INFO_SIZE_

        private static final int GROUP_INFO_SIZE_
        Size of the group information block in number of char
        See Also:
        Constant Field Values
      • m_tokenstringindex_

        private int m_tokenstringindex_
        Index of the offset information
      • m_groupindex_

        private int m_groupindex_
      • m_groupstringindex_

        private int m_groupstringindex_
      • m_algnamesindex_

        private int m_algnamesindex_
      • ALG_INFO_SIZE_

        private static final int ALG_INFO_SIZE_
        Size of an algorithmic name information group start code point size + end code point size + type size + variant size + size of data size
        See Also:
        Constant Field Values
      • DATA_FORMAT_ID_

        private static final int DATA_FORMAT_ID_
        File format id that this class understands.
        See Also:
        Constant Field Values
    • Constructor Detail

      • UCharacterNameReader

        protected UCharacterNameReader​(java.nio.ByteBuffer bytes)
                                throws java.io.IOException

        Protected constructor.

        Parameters:
        bytes - ICU uprop.dat file buffer
        Throws:
        java.io.IOException - throw if data file fails authentication
    • Method Detail

      • isDataVersionAcceptable

        public boolean isDataVersionAcceptable​(byte[] version)
        Description copied from interface: ICUBinary.Authenticate
        Method used in ICUBinary.readHeader() to provide data format authentication.
        Specified by:
        isDataVersionAcceptable in interface ICUBinary.Authenticate
        Parameters:
        version - version of the current data
        Returns:
        true if dataformat is an acceptable version, false otherwise
      • read

        protected void read​(UCharacterName data)
                     throws java.io.IOException
        Read and break up the stream of data passed in as arguments and fills up UCharacterName. If unsuccessful false will be returned.
        Parameters:
        data - instance of datablock
        Throws:
        java.io.IOException - thrown when there's a data error.
      • authenticate

        protected boolean authenticate​(byte[] dataformatid,
                                       byte[] dataformatversion)

        Checking the file for the correct format.

        Parameters:
        dataformatid -
        dataformatversion -
        Returns:
        true if the file format version is correct
      • readAlg

        private UCharacterName.AlgorithmName readAlg()
                                              throws java.io.IOException
        Reads an individual record of AlgorithmNames
        Returns:
        an instance of AlgorithNames if read is successful otherwise null
        Throws:
        java.io.IOException - thrown when file read error occurs or data is corrupted