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) 2008-2012, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 package com.ibm.icu.impl.javaspi.text; 10 11 import java.text.BreakIterator; 12 import java.text.spi.BreakIteratorProvider; 13 import java.util.Locale; 14 15 import com.ibm.icu.impl.javaspi.ICULocaleServiceProvider; 16 import com.ibm.icu.impl.jdkadapter.BreakIteratorICU; 17 18 public class BreakIteratorProviderICU extends BreakIteratorProvider { 19 20 @Override getCharacterInstance(Locale locale)21 public BreakIterator getCharacterInstance(Locale locale) { 22 com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getCharacterInstance( 23 ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); 24 return BreakIteratorICU.wrap(icuBrkItr); 25 } 26 27 @Override getLineInstance(Locale locale)28 public BreakIterator getLineInstance(Locale locale) { 29 com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getLineInstance( 30 ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); 31 return BreakIteratorICU.wrap(icuBrkItr); 32 } 33 34 @Override getSentenceInstance(Locale locale)35 public BreakIterator getSentenceInstance(Locale locale) { 36 com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getSentenceInstance( 37 ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); 38 return BreakIteratorICU.wrap(icuBrkItr); 39 } 40 41 @Override getWordInstance(Locale locale)42 public BreakIterator getWordInstance(Locale locale) { 43 com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getWordInstance( 44 ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); 45 return BreakIteratorICU.wrap(icuBrkItr); 46 } 47 48 @Override getAvailableLocales()49 public Locale[] getAvailableLocales() { 50 return ICULocaleServiceProvider.getAvailableLocales(); 51 } 52 53 } 54