diff options
author | Fredrik Roubert <roubert@google.com> | 2016-12-08 01:37:39 +0100 |
---|---|---|
committer | Fredrik Roubert <roubert@google.com> | 2016-12-13 18:53:43 +0100 |
commit | f86f25d102340da66b9c7cb6b2d5ecdc0de43ecf (patch) | |
tree | af5a0594c47df70789cf156a51d56f68e46dc8b8 /android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | |
parent | 49013b36214fc9187804b936e95dea4d1f27080e (diff) | |
download | icu-f86f25d102340da66b9c7cb6b2d5ecdc0de43ecf.tar.gz |
Integrate ICU4J 58.1 with Android patches into android_icu4j.
Bug: 31328818
Test: CtsIcuTestCases
Test: CtsLibcoreOjTestCases
Test: CtsLibcoreTestCases
Change-Id: Ifd74d26625c7e8c9bb76e88cf419029241117282
Diffstat (limited to 'android_icu4j/src/main/java/android/icu/impl/ICUBinary.java')
-rw-r--r-- | android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java b/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java index 57537793d..45aacd1d4 100644 --- a/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java +++ b/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java @@ -1,4 +1,6 @@ /* GENERATED SOURCE. DO NOT MODIFY. */ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html#License /* ******************************************************************************* * Copyright (C) 1996-2015, International Business Machines Corporation and @@ -41,7 +43,7 @@ public final class ICUBinary { private static final int DATA_FORMAT = 0x436d6e44; private static final class IsAcceptable implements Authenticate { - // @Override when we switch to Java 6 + @Override public boolean isDataVersionAcceptable(byte version[]) { return version[0] == 1; } @@ -369,7 +371,7 @@ public final class ICUBinary { } else if (i == key.length()) { return -1; // key < table key because key is shorter. } - int diff = (int)key.charAt(i) - c2; + int diff = key.charAt(i) - c2; if (diff != 0) { return diff; } @@ -388,7 +390,7 @@ public final class ICUBinary { } else if (i == key.length()) { return -1; // key < table key because key is shorter. } - int diff = (int)key.charAt(i) - c2; + int diff = key.charAt(i) - c2; if (diff != 0) { return diff; } @@ -404,13 +406,13 @@ public final class ICUBinary { { /** * Method used in ICUBinary.readHeader() to provide data format - * authentication. + * authentication. * @param version version of the current data * @return true if dataformat is an acceptable version, false otherwise */ public boolean isDataVersionAcceptable(byte version[]); } - + // public methods -------------------------------------------------------- /** @@ -572,7 +574,7 @@ public final class ICUBinary { */ public static int readHeader(ByteBuffer bytes, int dataFormat, Authenticate authenticate) throws IOException { - assert bytes.position() == 0; + assert bytes != null && bytes.position() == 0; byte magic1 = bytes.get(2); byte magic2 = bytes.get(3); if (magic1 != MAGIC1 || magic2 != MAGIC2) { @@ -612,7 +614,7 @@ public final class ICUBinary { bytes.position(headerSize); return // dataVersion - ((int)bytes.get(20) << 24) | + (bytes.get(20) << 24) | ((bytes.get(21) & 0xff) << 16) | ((bytes.get(22) & 0xff) << 8) | (bytes.get(23) & 0xff); @@ -769,23 +771,23 @@ public final class ICUBinary { } // private variables ------------------------------------------------- - + /** * Magic numbers to authenticate the data file */ private static final byte MAGIC1 = (byte)0xda; private static final byte MAGIC2 = (byte)0x27; - + /** * File format authentication values */ private static final byte CHAR_SET_ = 0; private static final byte CHAR_SIZE_ = 2; - + /** * Error messages */ - private static final String MAGIC_NUMBER_AUTHENTICATION_FAILED_ = + private static final String MAGIC_NUMBER_AUTHENTICATION_FAILED_ = "ICU data file error: Not an ICU data file"; private static final String HEADER_AUTHENTICATION_FAILED_ = "ICU data file error: Header authentication failed, please check if you have a valid ICU data file"; |