Home | History | Annotate | Download | only in impl
      1 /* GENERATED SOURCE. DO NOT MODIFY. */
      2 //  2016 and later: Unicode, Inc. and others.
      3 // License & terms of use: http://www.unicode.org/copyright.html#License
      4 /*
      5 *******************************************************************************
      6 *   Copyright (C) 2009-2016, International Business Machines
      7 *   Corporation and others.  All Rights Reserved.
      8 *******************************************************************************
      9 */
     10 
     11 package android.icu.impl;
     12 
     13 import java.util.MissingResourceException;
     14 
     15 import android.icu.util.UResourceBundle;
     16 import android.icu.util.VersionInfo;
     17 
     18 /**
     19  * @hide Only a subset of ICU is exposed in Android
     20  */
     21 public final class ICUDataVersion {
     22     private static final String U_ICU_VERSION_BUNDLE = "icuver";
     23 
     24     private static final String U_ICU_DATA_KEY = "DataVersion";
     25 
     26     /**
     27      * This function retrieves the data version from icuver and returns a VersionInfo object with that version information.
     28      *
     29      * @return Current icu data version
     30      */
     31     public static VersionInfo getDataVersion() {
     32         UResourceBundle icudatares = null;
     33         try {
     34             icudatares = UResourceBundle.getBundleInstance(
     35                     ICUData.ICU_BASE_NAME,
     36                     ICUDataVersion.U_ICU_VERSION_BUNDLE,
     37                     ICUResourceBundle.ICU_DATA_CLASS_LOADER);
     38             icudatares = icudatares.get(ICUDataVersion.U_ICU_DATA_KEY);
     39         } catch (MissingResourceException ex) {
     40             return null;
     41         }
     42 
     43         return  VersionInfo.getInstance(icudatares.getString());
     44     }
     45 }
     46