ICU-7083 make RBBI.getInstanceFromCompiledRules() public

X-SVN-Rev: 29929
This commit is contained in:
Andy Heninger 2011-04-29 18:05:42 +00:00
parent 0765a860a0
commit 022e2f80d4

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2005-2010 International Business Machines Corporation and *
* Copyright (C) 2005-2011 International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -38,9 +38,19 @@ public class RuleBasedBreakIterator extends BreakIterator {
}
/**
* Create a break iterator from a precompiled set of rules.
* @internal
* @deprecated This API is ICU internal only.
* Create a break iterator from a precompiled set of break rules.
*
* Creating a break iterator from the binary rules is much faster than
* creating one from source rules.
*
* The binary rules are generated by the RuleBasedBreakIterator.compileRules() function.
* Binary break iterator rules are not guaranteed to be compatible between
* different versions of ICU.
*
* @param is an input stream supplying the compiled binary rules.
* @throws IOException if there is an error while reading the rules from the InputStream.
* @see #compileRules(String, OutputStream)
* @draft ICU 4.8
*/
public static RuleBasedBreakIterator getInstanceFromCompiledRules(InputStream is) throws IOException {
RuleBasedBreakIterator This = new RuleBasedBreakIterator();
@ -307,7 +317,22 @@ public class RuleBasedBreakIterator extends BreakIterator {
}
}
private static void compileRules(String rules, OutputStream ruleBinary) throws IOException {
/**
* Compile a set of source break rules into the binary state tables used
* by the break iterator engine. Creating a break iterator from precompiled
* rules is much faster than creating one from source rules.
*
* Binary break rules are not guaranteed to be compatible between different
* versions of ICU.
*
*
* @param rules The source form of the break rules
* @param ruleBinary An output stream to receive the compiled rules.
* @throws IOException If there is an error writing the output.
* @see #getInstanceFromCompiledRules(InputStream)
* @draft ICU 4.8
*/
public static void compileRules(String rules, OutputStream ruleBinary) throws IOException {
RBBIRuleBuilder.compileRules(rules, ruleBinary);
}