public virtual void endElement(string namespaceURI, string localName, string qName) { if (String.instancehelper_equals(qName, (object) "Value")) { Double @double; try { @double = Double.valueOf(this.currentText.toString()); if (@double.isNaN()) { @double = (Double) null; goto label_5; } else goto label_5; } catch (NumberFormatException ex) { } @double = (Double) null; label_5: this.itemHandler.setValue((Number) @double); this.rootHandler.popSubHandler(); } else { string str = new StringBuffer().append("Expecting </Value> but found ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
public static string javascriptEscape(string input) { if (input == null) { string str = "Null 'input' argument."; Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new IllegalArgumentException(str); } else { StringBuffer stringBuffer = new StringBuffer(); int num1 = String.instancehelper_length(input); for (int index = 0; index < num1; ++index) { int num2 = (int) String.instancehelper_charAt(input, index); switch (num2) { case 34: stringBuffer.append("\\\""); break; case 39: stringBuffer.append("\\'"); break; case 92: stringBuffer.append("\\\\"); break; default: stringBuffer.append((char) num2); break; } } return stringBuffer.toString(); } }
public static string getImageMap(string name, ChartRenderingInfo info, ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, URLTagFragmentGenerator urlTagFragmentGenerator) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(new StringBuffer().append("<map id=\"").append(ImageMapUtilities.htmlEscape(name)).append("\" name=\"").append(ImageMapUtilities.htmlEscape(name)).append("\">").toString()); stringBuffer.append(StringUtils.getLineSeparator()); EntityCollection entityCollection = info.getEntityCollection(); if (entityCollection != null) { int i = entityCollection.getEntityCount() - 1; while (i >= 0) { ChartEntity entity = entityCollection.getEntity(i); if (entity.getToolTipText() != null || entity.getURLText() != null) { string imageMapAreaTag = entity.getImageMapAreaTag(toolTipTagFragmentGenerator, urlTagFragmentGenerator); if (String.instancehelper_length(imageMapAreaTag) > 0) { stringBuffer.append(imageMapAreaTag); stringBuffer.append(StringUtils.getLineSeparator()); } } i += -1; } } stringBuffer.append("</map>"); return stringBuffer.toString(); }
public static ImageEncoder newInstance(string format) { string str1 = (string) ImageEncoderFactory.encoders.get((object) format); if (str1 == null) { string str2 = new StringBuffer().append("Unsupported image format - ").append(format).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new IllegalArgumentException(str2); } else { Exception exception; try { return (ImageEncoder) Class.forName(str1, ImageEncoderFactory.__\u003CGetCallerID\u003E()).newInstance(ImageEncoderFactory.__\u003CGetCallerID\u003E()); } catch (Exception ex) { int num = 0; M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num); if (m0 == null) throw; else exception = (Exception) m0; } string str2 = Throwable.instancehelper_toString((Exception) exception); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new IllegalArgumentException(str2); } }
private String translate(Task task) { java.lang.StringBuffer buffer = new java.lang.StringBuffer( Utils.capitalize(getDisco().translate((Utterance)task))); Utils.endSentence(buffer); return(buffer.toString()); }
public KeyHandler(RootHandler rootHandler, ItemHandler itemHandler) { base.\u002Ector(); KeyHandler keyHandler = this; this.rootHandler = rootHandler; this.itemHandler = itemHandler; this.currentText = new StringBuffer(); }
public virtual string toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(this.getName()); stringBuffer.append(" version "); stringBuffer.append(this.getVersion()); stringBuffer.append(".\n"); stringBuffer.append(this.getCopyright()); stringBuffer.append(".\n"); stringBuffer.append("\n"); stringBuffer.append("For terms of use, see the licence below.\n"); stringBuffer.append("\n"); stringBuffer.append("FURTHER INFORMATION:"); stringBuffer.append(this.getInfo()); stringBuffer.append("\n"); stringBuffer.append("CONTRIBUTORS:"); if (this.contributors != null) { Iterator iterator = this.contributors.iterator(); while (iterator.hasNext()) { Contributor contributor = (Contributor) iterator.next(); stringBuffer.append(contributor.getName()); stringBuffer.append(" ("); stringBuffer.append(contributor.getEmail()); stringBuffer.append(")."); } } else stringBuffer.append("None"); stringBuffer.append("\n"); stringBuffer.append("OTHER LIBRARIES USED BY "); stringBuffer.append(this.getName()); stringBuffer.append(":"); Library[] libraries = this.getLibraries(); if (libraries.Length != 0) { for (int index = 0; index < libraries.Length; ++index) { Library library = libraries[index]; stringBuffer.append(library.getName()); stringBuffer.append(" "); stringBuffer.append(library.getVersion()); stringBuffer.append(" ("); stringBuffer.append(library.getInfo()); stringBuffer.append(")."); } } else stringBuffer.append("None"); stringBuffer.append("\n"); stringBuffer.append(this.getName()); stringBuffer.append(" LICENCE TERMS:"); stringBuffer.append("\n"); stringBuffer.append(this.getLicenceText()); return stringBuffer.toString(); }
// Documentation in subclasses because of synchro difference public virtual AbstractStringBuilder append(StringBuffer sb) { if (sb == null) return append(new String("null")); int len = sb.length(); ensureCapacityInternal(count + len); sb.getChars(0, len, value, count); count += len; return this; }
public virtual string toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(this.text); if (stringBuffer.length() < this.length) { char[] chArray = new char[this.length - stringBuffer.length()]; Arrays.fill(chArray, ' '); stringBuffer.append(chArray); } return stringBuffer.toString(); }
public virtual void startElement(string namespaceURI, string localName, string qName, Attributes atts) { if (String.instancehelper_equals(qName, (object) "Key")) { this.clearCurrentText(); } else { string str = new StringBuffer().append("Expecting <Key> but found ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
protected override string instanceToLibsvm(weka.core.Instance inst) { //StringBuffer.__<clinit>(); //StringBuffer buffer = new StringBuffer(new StringBuilder().append("").append(inst.classValue()).toString()); StringBuffer buffer = new StringBuffer(new StringBuilder().append("").append(inst.classValue() - 1).toString()); for (int i = 0; i < inst.numAttributes(); i++) { if ((i != inst.classIndex()) && (inst.value(i) != 0f)) { buffer.append(new StringBuilder().append(" ").append((int)(i + 1)).append(":").append(inst.value(i)).toString()); } } return buffer.toString(); }
public virtual void startElement(string namespaceURI, string localName, string qName, Attributes atts) { if (String.instancehelper_equals(qName, (object) "Item")) this.root.pushSubHandler((DefaultHandler) new KeyHandler(this.root, this)); else if (String.instancehelper_equals(qName, (object) "Value")) { this.root.pushSubHandler((DefaultHandler) new ValueHandler(this.root, this)); } else { string str = new StringBuffer().append("Expected <Item> or <Value>...found ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
public virtual void endElement(string namespaceURI, string localName, string qName) { if (String.instancehelper_equals(qName, (object) "Key")) { this.itemHandler.setKey((IComparable) this.getCurrentText()); this.rootHandler.popSubHandler(); this.rootHandler.pushSubHandler((DefaultHandler) new ValueHandler(this.rootHandler, this.itemHandler)); } else { string str = new StringBuffer().append("Expecting </Key> but found ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
internal static string ReplaceWithLookBehind (string input, string pattern, string lookBehindPattern, string replacement) { Pattern p = Pattern.compile (pattern); Pattern behindPattern = Pattern.compile (lookBehindPattern); Matcher m = p.matcher ((CharSequence) (object) input); StringBuffer sb = new StringBuffer (); while (m.find ()) { Matcher pm = behindPattern.matcher ((CharSequence) (object) input.Substring (0, m.start())); if(pm.find()) m.appendReplacement(sb, replacement); } m.appendTail (sb); return sb.ToString(); }
internal static string Reformat (Regex regex, string replacement) { replacement = JavaUtils.ReplaceAll (replacement, BACKSLASH_PATTERN, JAVA_BACKSLASH); replacement = JavaUtils.ReplaceAll (replacement, DOUBLE_DOLLAR_PATTERN, JAVA_DOLLAR); Pattern p = Pattern.compile (SINGLE_DOLLAR_PATTERN); Matcher m = p.matcher ((CharSequence) (object) replacement); StringBuffer sb = new StringBuffer (); while (m.find ()) { if (m.start (1) >= 0) { int groupNumber = regex.GroupNumberFromName (m.group (1)); if (groupNumber >= 0) { m.appendReplacement (sb, @"\$" + regex.GetJavaNumberByNetNumber (groupNumber)); continue; } if (int.TryParse (m.group (1), out groupNumber) && groupNumber <= regex.GroupCount) { m.appendReplacement (sb, @"\$" + regex.GetJavaNumberByNetNumber (groupNumber)); continue; } m.appendReplacement (sb, JAVA_DOLLAR + "{" + m.group (1) + "}"); continue; } if (m.start (2) >= 0) { int netGroupNumber = int.Parse (m.group (2)); if (netGroupNumber > regex.GroupCount) { m.appendReplacement (sb, JAVA_DOLLAR + netGroupNumber); continue; } m.appendReplacement (sb, @"\$" + regex.GetJavaNumberByNetNumber (netGroupNumber)); continue; } m.appendReplacement (sb, JAVA_DOLLAR); } m.appendTail (sb); return sb.ToString (); }
public virtual void startElement(string namespaceURI, string localName, string qName, Attributes atts) { if (String.instancehelper_equals(qName, (object) "Series")) { this.setSeriesKey((IComparable) atts.getValue("name")); this.root.pushSubHandler((DefaultHandler) new ItemHandler(this.root, (DefaultHandler) this)); } else if (String.instancehelper_equals(qName, (object) "Item")) { ItemHandler itemHandler = new ItemHandler(this.root, (DefaultHandler) this); this.root.pushSubHandler((DefaultHandler) itemHandler); itemHandler.startElement(namespaceURI, localName, qName, atts); } else { string str = new StringBuffer().append("Expecting <Series> or <Item> tag...found ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
public virtual void startElement(string namespaceURI, string localName, string qName, Attributes atts) { DefaultHandler currentHandler = this.getCurrentHandler(); if (currentHandler != this) currentHandler.startElement(namespaceURI, localName, qName, atts); else if (String.instancehelper_equals(qName, (object) "CategoryDataset")) this.dataset = new DefaultCategoryDataset(); else if (String.instancehelper_equals(qName, (object) "Series")) { CategorySeriesHandler categorySeriesHandler = new CategorySeriesHandler((RootHandler) this); this.getSubHandlers().push((object) categorySeriesHandler); categorySeriesHandler.startElement(namespaceURI, localName, qName, atts); } else { string str = new StringBuffer().append("Element not recognised: ").append(qName).toString(); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new SAXException(str); } }
// Method Summary /// <summary> /// Implements a non-terminal append-and-replace step. /// </summary> public Matcher appendReplacement(StringBuffer sb, string replacement) { return default(Matcher); }
public string StringFromBytes(byte[] byteArray) { //char[] characters = (new UnicodeEncoding()).GetChars(byteArray); /* java.io.StringWriter writer = new java.io.StringWriter(); writer.write(characters); StringBuffer javabuffer = new StringBuffer(); javabuffer.append(characters); return javabuffer.toString(); */ ByteBuffer bb = ByteBuffer.wrap(byteArray); //CharBuffer cb = bb.asCharBuffer(); StringBuffer javabuffer = new StringBuffer(); char[] ca = Charset.defaultCharset().decode(bb).array(); javabuffer.append(ca); string str0 = javabuffer.toString(); return str0; /* javabuffer = new StringBuffer(); CharBuffer cb = bb.asCharBuffer(); ca = cb.array(); javabuffer.append(ca); string str1 = javabuffer.toString(); return str1; */ }
/// <summary> /// Appends the specified {@code StringBuffer} to this sequence. /// <para> /// The characters of the {@code StringBuffer} argument are appended, /// in order, to this sequence, increasing the /// length of this sequence by the length of the argument. /// If {@code sb} is {@code null}, then the four characters /// {@code "null"} are appended to this sequence. /// </para> /// <para> /// Let <i>n</i> be the length of this character sequence just prior to /// execution of the {@code append} method. Then the character at index /// <i>k</i> in the new character sequence is equal to the character at /// index <i>k</i> in the old character sequence, if <i>k</i> is less than /// <i>n</i>; otherwise, it is equal to the character at index <i>k-n</i> /// in the argument {@code sb}. /// /// </para> /// </summary> /// <param name="sb"> the {@code StringBuffer} to append. </param> /// <returns> a reference to this object. </returns> public override StringBuilder Append(StringBuffer sb) { base.Append(sb); return(this); }
public String replaceFirst(String replacement) { if (replacement == null) throw new NullPointerException("replacement"); reset(); if (!find()) return text.toString(); StringBuffer sb = new StringBuffer(); appendReplacement(sb, replacement); appendTail(sb); return sb.toString(); }
public override string Replace (Regex regex, string input, string replacement, int count, int startat) { if (regex.SameGroupNamesFlag) { return base.Replace (regex, input, replacement, count, startat); } if (count < 0) { count = Int32.MaxValue; } string replacementPattern = ReplacementData.Reformat (regex, replacement); Matcher m = JavaPattern.matcher ((CharSequence) (object) input); StringBuffer sb = new StringBuffer (); if (count > 0 && m.find (startat)) { ReplacementData.ReplaceMatch (replacementPattern, m, sb, input, _patternData); } for (int matchesCounter = 1; matchesCounter < count; ++matchesCounter) { if (!m.find ()) { break; } ReplacementData.ReplaceMatch (replacementPattern, m, sb, input, _patternData); } m.appendTail (sb); return sb.ToString (); }
public new StringBuilder append(StringBuffer sb) { return(null); }
public StringBuffer appendTail(StringBuffer sb) { sb.append(text, lastAppendPosition, getTextLength()); return sb; }
/// <summary> /// Appends the specified /// </summary> public StringBuffer append(StringBuffer sb) { return(default(StringBuffer)); }
/// <summary> /// Formats the given <code>Date</code> into a date/time string and appends the result to the given <code>StringBuffer</code>. /// </summary> public override StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) { return default(StringBuffer); }
/// <summary> /// Formats a Date into a date/time string. /// </summary> public abstract StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition);
public virtual string toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(Object.instancehelper_getClass((object) this).getName()); stringBuffer.append("={ModuleClass="); stringBuffer.append(this.getModuleClass()); if (this.getMajorVersion() != null) { stringBuffer.append("; Version="); stringBuffer.append(this.getMajorVersion()); if (this.getMinorVersion() != null) { stringBuffer.append("-"); stringBuffer.append(this.getMinorVersion()); if (this.getPatchLevel() != null) { stringBuffer.append("_"); stringBuffer.append(this.getPatchLevel()); } } } stringBuffer.append("}"); return stringBuffer.toString(); }
/// <summary> /// Overrides Format. /// </summary> public StringBuffer format(object obj, StringBuffer toAppendTo, FieldPosition fieldPosition) { return default(StringBuffer); }
public new StringBuilder append(StringBuffer sb) { base.append(sb); return this; }
/// <summary> /// Allocates a new string that contains the sequence of characters /// currently contained in the string buffer argument. /// </summary> public String(StringBuffer @buffer) { }
/// <summary> /// Implements a terminal append-and-replace step. /// </summary> public StringBuffer appendTail(StringBuffer sb) { return default(StringBuffer); }
public new /*synchronized*/ StringBuffer append(StringBuffer sb) { base.append(sb); return(this); }
/* * public String(byte[] bytes, int offset, int length, String charsetName) { * if (charsetName == null) * throw new ArgumentNullException("charsetName"); * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(charsetName, bytes, offset, length); * } * * public String(byte[] bytes, int offset, int length, Charset charset) { * if (charset == null) * throw new ArgumentNullException("charset"); * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(charset, bytes, offset, length); * } * * public String(byte[] bytes, String charsetName) { * this(bytes, 0, bytes.length, charsetName); * } * * public String(byte[] bytes, Charset charset) { * this(bytes, 0, bytes.length, charset); * } * * public String(byte[] bytes, int offset, int length) { * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(bytes, offset, length); * } * * public String(byte[] bytes) { * this(bytes, 0, bytes.Length); * } */ public String(StringBuffer buffer) { lock (buffer) { this.value = Arrays.copyOf(buffer.getValue(), buffer.length()); } }
public boolean contentEquals(StringBuffer sb) { lock (sb) { return(contentEquals((CharSequence)sb)); } }
public new StringBuilder append(StringBuffer sb) { base.append(sb); return(this); }
internal static void ReplaceMatch (string replacementPattern, Matcher match, StringBuffer sb, string input, PatternData patternData) { replacementPattern = JavaUtils.ReplaceAll (replacementPattern, COPY_ENTIRE_MATCH_PATTERN, match.group ()); replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_BEFORE_MATCH_PATTERN, input.Substring (0, match.start ())); replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_AFTER_MATCH_PATTERN, input.Substring (match.end ())); replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_PATTERN, input); int groupsNumber = match.groupCount (); if (groupsNumber > 0) { Pattern p = Pattern.compile (LAST_CAPTURED_GROUP_PATTERN); Matcher m = p.matcher ((CharSequence) (object) replacementPattern); if (m.find ()) { while (groupsNumber > 0) { if (match.start (patternData.NetToJavaNumbersMap [groupsNumber]) >= 0) { break; } --groupsNumber; } if (groupsNumber > 0) { replacementPattern = m.replaceAll (match.group (patternData.NetToJavaNumbersMap [groupsNumber])); } } } match.appendReplacement (sb, replacementPattern); }
public String replaceAll(String replacement) { reset(); boolean result = find(); if (result) { StringBuffer sb = new StringBuffer(); do { appendReplacement(sb, replacement); result = find(); } while (result); appendTail(sb); return sb.toString(); } return text.toString(); }
public virtual AbstractStringBuilder append(StringBuffer sb) { return(this); }
public Matcher appendReplacement(StringBuffer sb, String replacement) { // If no match, return error if (first < 0) throw new InvalidOperationException("No match available"); // Process substitution string to replace group references with groups int cursor = 0; StringBuilder result = new StringBuilder(); while (cursor < replacement.length()) { char nextChar = replacement.charAt(cursor); if (nextChar == '\\') { cursor++; nextChar = replacement.charAt(cursor); result.append(nextChar); cursor++; } else if (nextChar == '$') { // Skip past $ cursor++; // A StringIndexOutOfBoundsException is thrown if // this "$" is the last character in replacement // string in current implementation, a IAE might be // more appropriate. nextChar = replacement.charAt(cursor); int refNum = -1; if (nextChar == '{') { cursor++; StringBuilder gsb = new StringBuilder(); while (cursor < replacement.length()) { nextChar = replacement.charAt(cursor); if (ASCII.isLower(nextChar) || ASCII.isUpper(nextChar) || ASCII.isDigit(nextChar)) { gsb.append(nextChar); cursor++; } else { break; } } if (gsb.length() == 0) throw new IllegalArgumentException( "named capturing group has 0 length name"); if (nextChar != '}') throw new IllegalArgumentException( "named capturing group is missing trailing '}'"); String gname = gsb.toString(); if (ASCII.isDigit(gname.charAt(0))) throw new IllegalArgumentException( "capturing group name {" + gname + "} starts with digit character"); if (!parentPattern.namedGroups().containsKey(gname)) throw new IllegalArgumentException( "No group with name {" + gname + "}"); refNum = parentPattern.namedGroups().get(gname); cursor++; } else { // The first number is always a group refNum = (int)nextChar - '0'; if ((refNum < 0)||(refNum > 9)) throw new IllegalArgumentException( "Illegal group reference"); cursor++; // Capture the largest legal group string boolean done = false; while (!done) { if (cursor >= replacement.length()) { break; } int nextDigit = replacement.charAt(cursor) - '0'; if ((nextDigit < 0)||(nextDigit > 9)) { // not a number break; } int newRefNum = (refNum * 10) + nextDigit; if (groupCount() < newRefNum) { done = true; } else { refNum = newRefNum; cursor++; } } } // Append group if (start(refNum) != -1 && end(refNum) != -1) result.append(text, start(refNum), end(refNum)); } else { result.append(nextChar); cursor++; } } // Append the intervening text sb.append(text, lastAppendPosition, first); // Append the match substitution sb.append(result); lastAppendPosition = last; return this; }
/// <summary> /// Returns <tt>true</tt> if and only if this <tt>String</tt> represents /// the same sequence of characters as the specified <tt>StringBuffer</tt>. /// </summary> public bool contentEquals(StringBuffer @sb) { return(default(bool)); }