/** * Cover JDK 1.5 APIs. Append the code point to the buffer and return the buffer as a * convenience. * * @param target The buffer to append to * @param cp The code point to append * @return the updated StringBuffer * @throws IllegalArgumentException If cp is not a valid code point * @stable ICU 3.0 */ public static StringBuffer appendCodePoint(StringBuffer target, int cp) { return append(target, cp); }
private CoderResult toUWriteCodePoint(int c, CharBuffer target, IntBuffer offsets, int sourceIndex) { CoderResult cr = CoderResult.UNDERFLOW; int tBeginIndex = target.position(); if (target.hasRemaining()) { if (c <= 0xffff) { target.put((char) c); c = UConverterConstants.U_SENTINEL; } else /* c is a supplementary code point */{ target.put(UTF16.getLeadSurrogate(c)); c = UTF16.getTrailSurrogate(c); if (target.hasRemaining()) { target.put((char) c); c = UConverterConstants.U_SENTINEL; } } /* write offsets */ if (offsets != null) { offsets.put(sourceIndex); if ((tBeginIndex + 1) < target.position()) { offsets.put(sourceIndex); } } } /* write overflow from c */ if (c >= 0) { charErrorBufferLength = UTF16.append(charErrorBufferArray, 0, c); cr = CoderResult.OVERFLOW; } return cr; }
default: if (usingSlash) { UTF16.append(buffer, cp); quoteStatus = NONE; continue main; if (hexCount == 0) { quoteStatus = NONE; UTF16.append(buffer, hexValue); UTF16.append(buffer, cp); quoteStatus = NORMAL_QUOTE; continue main; UTF16.append(buffer, cp); UTF16.append(buffer, cp); quoteStatus = NORMAL_QUOTE; continue main; UTF16.append(buffer, cp); continue main; UTF16.append(buffer, cp); start = i + UTF16.getCharCount(cp); return SYNTAX; UTF16.append(buffer, cp);
/** * Returns a rule string for this transliterator. This is * a non-overrideable base class implementation that subclasses * may call. It simply munges the ID into the correct format, * that is, "foo" => "::foo". * @param escapeUnprintable if true, then unprintable characters * will be converted to escape form backslash-'u' or * backslash-'U'. * @stable ICU 2.0 */ protected final String baseToRules(boolean escapeUnprintable) { // The base class implementation of toRules munges the ID into // the correct format. That is: foo => ::foo // KEEP in sync with rbt_pars if (escapeUnprintable) { StringBuffer rulesSource = new StringBuffer(); String id = getID(); for (int i=0; i<id.length();) { int c = UTF16.charAt(id, i); if (!Utility.escapeUnprintable(rulesSource, c)) { UTF16.append(rulesSource, c); } i += UTF16.getCharCount(c); } rulesSource.insert(0, "::"); rulesSource.append(ID_DELIM); return rulesSource.toString(); } return "::" + getID() + ID_DELIM; }
position); UTF16.append(buf, c32); position = posref[0]; } else if ((quote != 0 && c == quote) ||
errorInputLength = UTF16.append(invalidUCharBuffer, 0, fromUChar32); invalidUCharLength = errorInputLength;
UTF16.append(name, c);
if (PROGRESS) System.out.println(" buffer: " + Utility.hex(UTF16.valueOf(cp))); UTF16.append(buf, cp);
UTF16.append(dest,ch);
UTF16.append(dest, c); j += UTF16.getCharCount(c);
UTF16.append(buf, escaped); continue;
if (r == null) { UTF16.append(buf, c); } else { isComplex = true;
length=UTF16.append(s, length, c); extGetUnicodeSetString(cx,setFillIn,useFallback,minLength,c,s,length,FROM_U_GET_PARTIAL_INDEX(value)); } else if ((useFallback ? (value&FROM_U_RESERVED_MASK)==0 :((value&(FROM_U_ROUNDTRIP_FLAG|FROM_U_RESERVED_MASK))== FROM_U_ROUNDTRIP_FLAG)) &&