1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.icu.text; 18 19 import java.util.Locale; 20 import libcore.api.IntraCoreApi; 21 import libcore.util.NonNull; 22 23 /** 24 * Provide functionalities implemented by ICU4C for {@link libcore.icu.TimeZoneNames} and 25 * the implementation should be faster than the public APIs provided by 26 * {@link android.icu.text.TimeZoneNames}. 27 * 28 * @hide 29 */ 30 @IntraCoreApi 31 public final class TimeZoneNamesNative { 32 TimeZoneNamesNative()33 private TimeZoneNamesNative() {} 34 35 /** 36 * For each tzId passed returns a list of arrays of five elements: Olson name, long name, 37 * short name, long DST name and short DST name. 38 * 39 * @param locale Locale object 40 * @param tzIds List of timezone ids 41 * @see libcore.icu.TimeZoneNames.ZoneStringsCache#create(java.util.Locale) 42 * @return List of [Time zone id, long, short, long DST, short DST] for each id from 43 * {@code tzIds}. Any of these value except Olson name can be null. 44 * 45 * @hide 46 */ 47 @IntraCoreApi getFilledZoneStrings(@onNull Locale locale, @NonNull String[] tzIds)48 public static String[][] getFilledZoneStrings(@NonNull Locale locale, @NonNull String[] tzIds) { 49 String[][] result = new String[tzIds.length][5]; 50 for (int i = 0; i < tzIds.length; ++i) { 51 result[i][0] = tzIds[i]; 52 } 53 fillZoneStringsNative(locale.toLanguageTag(), result); 54 return result; 55 } 56 fillZoneStringsNative(String locale, String[][] result)57 private static native void fillZoneStringsNative(String locale, String[][] result); 58 } 59