Removed restriction on Unicode versions

X-SVN-Rev: 9516
This commit is contained in:
Syn Wee Quek 2002-08-01 19:50:34 +00:00
parent 4d8623bdc3
commit 69f48a98d3
5 changed files with 26 additions and 37 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/ICUBinary.java,v $
* $Date: 2002/03/10 19:40:15 $
* $Revision: 1.5 $
* $Date: 2002/08/01 19:50:26 $
* $Revision: 1.6 $
* *****************************************************************************************
*/
package com.ibm.icu.impl;
@ -73,10 +73,9 @@ public final class ICUBinary
* when header authentication fails.
* @draft 2.1
*/
public static final void readHeader(InputStream inputStream,
public static final byte[] readHeader(InputStream inputStream,
byte dataFormatIDExpected[],
byte dataVersionExpected[],
byte unicodeVersionExpected[])
byte dataVersionExpected[])
throws IOException
{
DataInputStream input = new DataInputStream(inputStream);
@ -116,12 +115,12 @@ public final class ICUBinary
input.skipBytes(headersize);
if (bigendian != BIG_ENDIAN_ || charset != CHAR_SET_ ||
charsize != CHAR_SIZE_ ||
charsize != CHAR_SIZE_ ||
!Arrays.equals(dataFormatIDExpected, dataFormatID) ||
!Arrays.equals(dataVersionExpected, dataVersion) ||
!Arrays.equals(unicodeVersionExpected, unicodeVersion)) {
!Arrays.equals(dataVersionExpected, dataVersion)) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_);
}
return unicodeVersion;
}
// private variables -------------------------------------------------

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/NormalizerDataReader.java,v $
* $Date: 2002/07/30 02:32:56 $
* $Revision: 1.6 $
* $Date: 2002/08/01 19:50:26 $
* $Revision: 1.7 $
*******************************************************************************
*/
@ -290,7 +290,7 @@ final class NormalizerDataReader {
if(debug) System.out.println("Bytes in inputStream " + inputStream.available());
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID,
DATA_FORMAT_VERSION, UNICODE_VERSION);
DATA_FORMAT_VERSION);
if(debug) System.out.println("Bytes left in inputStream " +inputStream.available());
@ -394,9 +394,5 @@ final class NormalizerDataReader {
(byte)0x72, (byte)0x6D};
private static final byte DATA_FORMAT_VERSION[] = {(byte)0x2, (byte)0x1,
(byte)0x5, (byte)0x2};
//TODO: Set the version info after the VersionInfo class is ported
private static final byte UNICODE_VERSION[] = {(byte)0x3, (byte)0x2,
(byte)0x0, (byte)0x0};
private static final String UNICODE_VERSION_STRING = "3.2.0.0";
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/UCharacterPropertyReader.java,v $
* $Date: 2002/07/30 02:32:55 $
* $Revision: 1.5 $
* $Date: 2002/08/01 19:50:26 $
* $Revision: 1.6 $
*
*******************************************************************************
*/
@ -47,8 +47,8 @@ final class UCharacterPropertyReader
protected UCharacterPropertyReader(InputStream inputStream)
throws IOException
{
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_, UNICODE_VERSION_);
m_unicodeVersion_ = ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_);
m_dataInputStream_ = new DataInputStream(inputStream);
}
@ -120,8 +120,8 @@ final class UCharacterPropertyReader
m_dataInputStream_.close();
ucharppty.m_additionalColumnsCount_ = m_additionalColumnsCount_;
ucharppty.m_unicodeVersion_ = VersionInfo.getInstance(
(int)UNICODE_VERSION_[0], (int)UNICODE_VERSION_[1],
(int)UNICODE_VERSION_[2], (int)UNICODE_VERSION_[3]);
(int)m_unicodeVersion_[0], (int)m_unicodeVersion_[1],
(int)m_unicodeVersion_[2], (int)m_unicodeVersion_[3]);
}
// private variables -------------------------------------------------
@ -146,6 +146,7 @@ final class UCharacterPropertyReader
private int m_additionalVectorsOffset_;
private int m_additionalColumnsCount_;
private int m_reservedOffset_;
private byte m_unicodeVersion_[];
/**
* File format version that this class understands.
@ -156,6 +157,4 @@ final class UCharacterPropertyReader
private static final byte DATA_FORMAT_VERSION_[] = {(byte)0x3, (byte)0x1,
(byte)Trie.INDEX_STAGE_1_SHIFT_,
(byte)Trie.INDEX_STAGE_2_SHIFT_};
private static final byte UNICODE_VERSION_[] = {(byte)0x3, (byte)0x2,
(byte)0x0, (byte)0x0};
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/lang/Attic/UCharacterNameReader.java,v $
* $Date: 2002/07/30 02:38:11 $
* $Revision: 1.10 $
* $Date: 2002/08/01 19:50:26 $
* $Revision: 1.11 $
*
*******************************************************************************
*/
@ -49,7 +49,7 @@ final class UCharacterNameReader
throws IOException
{
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_, UNICODE_VERSION_);
DATA_FORMAT_VERSION_);
m_dataInputStream_ = new DataInputStream(inputStream);
}
@ -158,10 +158,7 @@ final class UCharacterNameReader
private static final byte DATA_FORMAT_VERSION_[] =
{(byte)0x1, (byte)0x0, (byte)0x0, (byte)0x0};
private static final byte DATA_FORMAT_ID_[] = {(byte)0x75, (byte)0x6E,
(byte)0x61, (byte)0x6D};
private static final byte UNICODE_VERSION_[] = {(byte)0x3, (byte)0x2,
(byte)0x0, (byte)0x0};
(byte)0x61, (byte)0x6D};
/**
* Corrupted error string
*/

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/CollatorReader.java,v $
* $Date: 2002/07/30 02:38:12 $
* $Revision: 1.5 $
* $Date: 2002/08/01 19:50:34 $
* $Revision: 1.6 $
*
*******************************************************************************
*/
@ -45,7 +45,7 @@ final class CollatorReader
protected CollatorReader(InputStream inputStream) throws IOException
{
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_, UNICODE_VERSION_);
DATA_FORMAT_VERSION_);
m_dataInputStream_ = new DataInputStream(inputStream);
}
@ -61,7 +61,7 @@ final class CollatorReader
{
if (readICUHeader) {
ICUBinary.readHeader(inputStream, DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_, UNICODE_VERSION_);
DATA_FORMAT_VERSION_);
}
m_dataInputStream_ = new DataInputStream(inputStream);
}
@ -345,7 +345,7 @@ final class CollatorReader
throws IOException
{
ICUBinary.readHeader(inputStream, INVERSE_UCA_DATA_FORMAT_ID_,
DATA_FORMAT_VERSION_, UNICODE_VERSION_);
DATA_FORMAT_VERSION_);
CollationParsedRuleBuilder.InverseUCA result =
new CollationParsedRuleBuilder.InverseUCA();
DataInputStream input = new DataInputStream(inputStream);
@ -385,8 +385,6 @@ final class CollatorReader
{(byte)0x2, (byte)0x0, (byte)0x0, (byte)0x0};
private static final byte DATA_FORMAT_ID_[] = {(byte)0x55, (byte)0x43,
(byte)0x6f, (byte)0x6c};
private static final byte UNICODE_VERSION_[] = {(byte)0x3, (byte)0x0,
(byte)0x0, (byte)0x0};
/**
* Inverse UCA file format version and id that this class understands.
* No guarantees are made if a older version is used