Class UCharacterNameReader

java.lang.Object
com.ibm.icu.impl.UCharacterNameReader
All Implemented Interfaces:
ICUBinary.Authenticate

final class UCharacterNameReader extends 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
  • Field Details

    • m_byteBuffer_

      private 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:
    • 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:
    • DATA_FORMAT_ID_

      private static final int DATA_FORMAT_ID_
      File format id that this class understands.
      See Also:
  • Constructor Details

    • UCharacterNameReader

      protected UCharacterNameReader(ByteBuffer bytes) throws IOException

      Protected constructor.

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

    • 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 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:
      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 IOException
      Reads an individual record of AlgorithmNames
      Returns:
      an instance of AlgorithNames if read is successful otherwise null
      Throws:
      IOException - thrown when file read error occurs or data is corrupted