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