public static boolean isCodeRangeAsciiOnly(CodeRangeable string) { return string.getCodeRange() == CR_7BIT; }
public static boolean isCodeRangeAsciiOnly(CodeRangeable string) { return string.getCodeRange() == CR_7BIT; }
public static boolean isSingleByteOptimizable(CodeRangeable string, Encoding encoding) { return string.getCodeRange() == CR_7BIT || encoding.maxLength() == 1; }
public static boolean isSingleByteOptimizable(CodeRangeable string, Encoding encoding) { return string.getCodeRange() == CR_7BIT || encoding.maxLength() == 1; }
public static void replaceInternal19(int beg, int len, CodeRangeable source, CodeRangeable repl) { Encoding enc = source.checkEncoding(repl); source.modify(); source.keepCodeRange(); ByteList sourceBL = source.getByteList(); byte[] sourceBytes = sourceBL.unsafeBytes(); int sourceBeg = sourceBL.begin(); int sourceEnd = sourceBeg + sourceBL.realSize(); boolean singlebyte = isSingleByteOptimizable(source, source.getByteList().getEncoding()); int p = nth(enc, sourceBytes, sourceBeg, sourceEnd, beg, singlebyte); if (p == -1) p = sourceEnd; int e = nth(enc, sourceBytes, p, sourceEnd, len, singlebyte); if (e == -1) e = sourceEnd; /* error check */ beg = p - sourceBeg; /* physical position */ len = e - p; /* physical length */ replaceInternal(beg, len, source, repl); associateEncoding(source, enc); int cr = CodeRangeSupport.codeRangeAnd(source.getCodeRange(), repl.getCodeRange()); if (cr != CR_BROKEN) source.setCodeRange(cr); }
public static void replaceInternal19(int beg, int len, CodeRangeable source, CodeRangeable repl) { Encoding enc = source.checkEncoding(repl); source.modify(); source.keepCodeRange(); ByteList sourceBL = source.getByteList(); byte[] sourceBytes = sourceBL.unsafeBytes(); int sourceBeg = sourceBL.begin(); int sourceEnd = sourceBeg + sourceBL.realSize(); boolean singlebyte = isSingleByteOptimizable(source, source.getByteList().getEncoding()); int p = nth(enc, sourceBytes, sourceBeg, sourceEnd, beg, singlebyte); if (p == -1) p = sourceEnd; int e = nth(enc, sourceBytes, p, sourceEnd, len, singlebyte); if (e == -1) e = sourceEnd; /* error check */ beg = p - sourceBeg; /* physical position */ len = e - p; /* physical length */ replaceInternal(beg, len, source, repl); associateEncoding(source, enc); int cr = CodeRangeSupport.codeRangeAnd(source.getCodeRange(), repl.getCodeRange()); if (cr != CR_BROKEN) source.setCodeRange(cr); }
boolean incompatible = false; str_cr = str.getByteList().getRealSize() > 0 ? str.getCodeRange() : StringSupport.CR_7BIT;
boolean incompatible = false; str_cr = str.getByteList().getRealSize() > 0 ? str.getCodeRange() : StringSupport.CR_7BIT;
final ByteList replList = replStr.getByteList(); int cr = self.getCodeRange(); Encoding e1 = self.checkEncoding(srcStr); Encoding e2 = self.checkEncoding(replStr);
final ByteList replList = replStr.getByteList(); int cr = self.getCodeRange(); Encoding e1 = self.checkEncoding(srcStr); Encoding e2 = self.checkEncoding(replStr);