use of android.icu.util.ICUUncheckedIOException in project j2objc by google.
the class CaseMapImpl method fold.
public static <A extends Appendable> A fold(int options, CharSequence src, A dest, Edits edits) {
try {
if (edits != null) {
edits.reset();
}
int length = src.length();
for (int i = 0; i < length; ) {
int c = Character.codePointAt(src, i);
int cpLength = Character.charCount(c);
i += cpLength;
c = UCaseProps.INSTANCE.toFullFolding(c, dest, options);
appendResult(c, dest, cpLength, options, edits);
}
return dest;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
use of android.icu.util.ICUUncheckedIOException in project j2objc by google.
the class CaseMapImpl method toLower.
public static <A extends Appendable> A toLower(int caseLocale, int options, CharSequence src, A dest, Edits edits) {
try {
if (edits != null) {
edits.reset();
}
StringContextIterator iter = new StringContextIterator(src);
internalToLower(caseLocale, options, iter, dest, edits);
return dest;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
use of android.icu.util.ICUUncheckedIOException in project j2objc by google.
the class Normalizer2Impl method load.
public Normalizer2Impl load(ByteBuffer bytes) {
try {
dataVersion = ICUBinary.readHeaderAndDataVersion(bytes, DATA_FORMAT, IS_ACCEPTABLE);
// inIndexes[IX_NORM_TRIE_OFFSET]/4
int indexesLength = bytes.getInt() / 4;
if (indexesLength <= IX_MIN_LCCC_CP) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough indexes");
}
int[] inIndexes = new int[indexesLength];
inIndexes[0] = indexesLength * 4;
for (int i = 1; i < indexesLength; ++i) {
inIndexes[i] = bytes.getInt();
}
minDecompNoCP = inIndexes[IX_MIN_DECOMP_NO_CP];
minCompNoMaybeCP = inIndexes[IX_MIN_COMP_NO_MAYBE_CP];
minLcccCP = inIndexes[IX_MIN_LCCC_CP];
minYesNo = inIndexes[IX_MIN_YES_NO];
minYesNoMappingsOnly = inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
minNoNo = inIndexes[IX_MIN_NO_NO];
minNoNoCompBoundaryBefore = inIndexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE];
minNoNoCompNoMaybeCC = inIndexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC];
minNoNoEmpty = inIndexes[IX_MIN_NO_NO_EMPTY];
limitNoNo = inIndexes[IX_LIMIT_NO_NO];
minMaybeYes = inIndexes[IX_MIN_MAYBE_YES];
// 8-aligned for noNoDelta bit fields
assert ((minMaybeYes & 7) == 0);
centerNoNoDelta = (minMaybeYes >> DELTA_SHIFT) - MAX_DELTA - 1;
// Read the normTrie.
int offset = inIndexes[IX_NORM_TRIE_OFFSET];
int nextOffset = inIndexes[IX_EXTRA_DATA_OFFSET];
normTrie = Trie2_16.createFromSerialized(bytes);
int trieLength = normTrie.getSerializedLength();
if (trieLength > (nextOffset - offset)) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough bytes for normTrie");
}
// skip padding after trie bytes
ICUBinary.skipBytes(bytes, (nextOffset - offset) - trieLength);
// Read the composition and mapping data.
offset = nextOffset;
nextOffset = inIndexes[IX_SMALL_FCD_OFFSET];
int numChars = (nextOffset - offset) / 2;
if (numChars != 0) {
maybeYesCompositions = ICUBinary.getString(bytes, numChars, 0);
extraData = maybeYesCompositions.substring((MIN_NORMAL_MAYBE_YES - minMaybeYes) >> OFFSET_SHIFT);
}
// smallFCD: new in formatVersion 2
offset = nextOffset;
smallFCD = new byte[0x100];
bytes.get(smallFCD);
return this;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
Aggregations