static string ToStringMulti(long v, java.lang.reflect.Field[] fields, int n) { var v0 = v; var sb = new java.lang.StringBuilder(); bool comma = false; for (int i = 0; i < n; i++) { var f = fields[i]; if (f.getModifiers() == (java.lang.reflect.Modifier.PUBLIC | java.lang.reflect.Modifier.STATIC)) { f.setAccessible(true); var fv = f.getLong(null); if ((fv & v) == fv) { if (fv == 0 && v0 != 0) { // skip field for zero, if value was not zero continue; } v &= ~fv; if (comma) { sb.append(", "); } sb.append(f.getName()); comma = true; } } } return((v == 0) ? sb.ToString() : null); }
public string encode(string s, java.nio.charset.Charset charset) { // Guess a bit larger for encoded form java.lang.StringBuilder builder = new java.lang.StringBuilder(s.Length + 16); appendEncoded(builder, s, charset, false); return(builder.ToString()); }
public static java.lang.String test() { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append('a'); sb.append('\u0062'); sb.append('\x63'); return sb.toString(); }
public override string ToString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(128); sb.append("{"); sb.append(applicationDensity); sb.append("dpi"); if (isScalingRequired()) { sb.append(" "); sb.append(applicationScale); sb.append("x"); } if (!supportsScreen()) { sb.append(" resizing"); } if (neverSupportsScreen()) { sb.append(" never-compat"); } if (alwaysSupportsScreen()) { sb.append(" always-compat"); } sb.append("}"); return(sb.ToString()); }
public RewriterResults rewrite(Gadget gadget, MutableContent content) { if (gadget.getSpec().getModulePrefs().getFeatures().ContainsKey("caja") || "1".Equals(gadget.getContext().getParameter("caja"))) { URI retrievedUri = gadget.getContext().getUrl(); UriCallback2 cb = new UriCallback2(retrievedUri); MessageQueue mq = new SimpleMessageQueue(); DefaultGadgetRewriter rw = new DefaultGadgetRewriter(mq); CharProducer input = CharProducer.Factory.create( new java.io.StringReader(content.getContent()), FilePosition.instance(new InputSource(new java.net.URI(retrievedUri.ToString())), 2, 1, 1)); java.lang.StringBuilder output = new java.lang.StringBuilder(); try { rw.rewriteContent(new java.net.URI(retrievedUri.ToString()), input, cb, output); } catch (GadgetRewriteException e) { throwCajolingException(e, mq); return(RewriterResults.notCacheable()); } catch (IOException e) { throwCajolingException(e, mq); return(RewriterResults.notCacheable()); } content.setContent(tameCajaClientApi() + output.ToString()); } return(null); }
public static string Join(string separator, params object[] values) { if (values == null) { throw new ArgumentNullException("values"); } if ((values.Length == 0) || (values[0] == null)) { return(string.Empty); } if (separator == null) { separator = string.Empty; } javaStringBuilder resultBuilder = new javaStringBuilder(); resultBuilder.append(values[0].ToString() ?? string.Empty); for (int i = 1; i < values.Length; i++) { resultBuilder.append(separator); resultBuilder.append(values[i].ToString() ?? string.Empty); } return(resultBuilder.ToString()); }
public static string Join(string separator, IEnumerable <string> values) { if (values == null) { throw new ArgumentNullException("values"); } if (separator == null) { separator = string.Empty; } javaStringBuilder resultBuilder = new javaStringBuilder(); bool first = true; foreach (string v in values) { if (first) { first = false; } else { resultBuilder.append(separator); } if (v != null) { resultBuilder.append(v); } } return(resultBuilder.ToString()); }
/// <summary>Print a progress bar and percent of progress to console.</summary> /// <remarks> /// Print a progress bar and percent of progress to console. In this format: /// [====================================================================================================] /// 100% /// </remarks> /// <param name="percentProgress"> /// Percent of progress. Integer value has to be /// between 0 and 100. /// </param> public static void printProgressBar(int percentProgress) { if (percentProgress >= 0 || percentProgress <= 100) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("["); for (int i = 0; i < percentProgress; i++) { sb.append("="); } for (int i_1 = 100; i_1 > percentProgress; i_1--) { sb.append("."); } sb.append("] "); sb.append(percentProgress); sb.append("%"); sb.append("\r"); Console.Out.Write(sb.ToString()); } else { Console.Out.Write("Input has to between 0 and 100."); } }
/// <summary> /// Returns the ASCII characters up to but not including the next "\r\n", or /// "\n". /// </summary> /// <remarks> /// Returns the ASCII characters up to but not including the next "\r\n", or /// "\n". /// </remarks> /// <exception cref="java.io.EOFException"> /// if the stream is exhausted before the next newline /// character. /// </exception> /// <exception cref="System.IO.IOException"></exception> public static string readAsciiLine(java.io.InputStream @in) { // TODO: support UTF-8 here instead java.lang.StringBuilder result = new java.lang.StringBuilder(80); while (true) { int c = @in.read(); if (c == -1) { throw new java.io.EOFException(); } else { if (c == '\n') { break; } } result.append((char)c); } int length = result.Length; if (length > 0 && result[length - 1] == '\r') { result.setLength(length - 1); } return(result.ToString()); }
internal string toString(long now) { java.lang.StringBuilder b = new java.lang.StringBuilder(); b.append("{ what="); b.append(what); b.append(" when="); android.util.TimeUtils.formatDuration(when - now, b); if (arg1 != 0) { b.append(" arg1="); b.append(arg1); } if (arg2 != 0) { b.append(" arg2="); b.append(arg2); } if (obj != null) { b.append(" obj="); b.append(obj); } b.append(" }"); return(b.ToString()); }
public override string ToString() { if (isEmpty()) { return("[]"); } java.lang.StringBuilder buffer = new java.lang.StringBuilder(size() * 16); buffer.append('['); java.util.Iterator <E> it = iterator(); while (it.hasNext()) { object next = it.next(); if (next != this) { buffer.append(next); } else { buffer.append("(this Collection)"); } if (it.hasNext()) { buffer.append(", "); } } buffer.append(']'); return(buffer.ToString()); }
/// <summary>Creates a new instance of a XML Serializer.</summary> /// <remarks> /// Creates a new instance of a XML Serializer. /// <p><b>NOTE:</b> factory features are not used for XML Serializer. /// </remarks> /// <returns>A new instance of a XML Serializer.</returns> /// <exception cref="XmlPullParserException"> /// if a parser cannot be created which satisfies the /// requested configuration. /// </exception> /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception> public virtual org.xmlpull.v1.XmlSerializer newSerializer() { if (serializerClasses == null) { throw new org.xmlpull.v1.XmlPullParserException("Factory initialization incomplete - has not tried " + classNamesLocation); } if (serializerClasses.size() == 0) { throw new org.xmlpull.v1.XmlPullParserException("No valid serializer classes found in " + classNamesLocation); } java.lang.StringBuilder issues = new java.lang.StringBuilder(); { for (int i = 0; i < serializerClasses.size(); i++) { System.Type ppClass = (System.Type)serializerClasses.get(i); try { org.xmlpull.v1.XmlSerializer ser = (org.xmlpull.v1.XmlSerializer)System.Activator.CreateInstance (ppClass); return(ser); } catch (System.Exception ex) { issues.append(ppClass.FullName + ": " + ex.ToString() + "; "); } } } throw new org.xmlpull.v1.XmlPullParserException("could not create serializer: " + issues); }
/// <exception cref="VPackException"/> public virtual string toJson(VPackSlice vpack, bool includeNullValues ) { java.lang.StringBuilder json = new java.lang.StringBuilder(); this.parse(null, null, vpack, json, includeNullValues); return(json.ToString()); }
public override string ToString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(64); sb.append("Transformation"); toShortString(sb); return(sb.ToString()); }
public static string Replace(java.lang.String str, string oldStr, string newStr) { ThrowHelper.ThrowIfNull(oldStr); int lenOld = ((java.lang.String)(object) oldStr).length(); if (lenOld == 0) { throw new System.ArgumentException(); } int idx1 = str.indexOf(oldStr, 0); if (idx1 == -1) { return((string)(object)str); } int idx0 = 0; int len = str.length(); var sb = new java.lang.StringBuilder(); for (;;) { sb.append(str.substring(idx0, idx1)); if (newStr != null) { sb.append(newStr); } if ((idx0 = idx1 + lenOld) >= len || (idx1 = str.indexOf(oldStr, idx0)) == -1) { sb.append(str.substring(idx0)); return(sb.ToString()); } } }
/** Splits a backslash escaped string on the separator. * <p> * Current backslash escaping supported: * <br> \n \t \r \b \f are escaped the same as a Java String * <br> Other characters following a backslash are produced verbatim (\c => c) * * @param s the string to split * @param separator the separator to split on * @param decode decode backslash escaping */ public static List /*<String>*/ splitSmart(string s, string separator, bool decode) { ArrayList /*<String>*/ lst = new ArrayList/*<String>*/ (2); java.lang.StringBuilder sb = new java.lang.StringBuilder(); int pos = 0, end = s.Length; while (pos < end) { if (java.lang.String.instancehelper_startsWith(s, separator, pos)) { if (sb.length() > 0) { lst.add(sb.toString()); sb = new java.lang.StringBuilder(); } pos += separator.Length; continue; } char ch = s[pos++]; if (ch == '\\') { if (!decode) { sb.append(ch); } if (pos >= end) { break; // ERROR, or let it go? } ch = s[pos++]; if (decode) { switch (ch) { case 'n': ch = '\n'; break; case 't': ch = '\t'; break; case 'r': ch = '\r'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; } } } sb.append(ch); } if (sb.length() > 0) { lst.add(sb.toString()); } return(lst); }
/// <hide></hide> public virtual void toShortString(java.lang.StringBuilder sb) { sb.append("{alpha="); sb.append(mAlpha); sb.append(" matrix="); mMatrix.toShortString(sb); sb.append('}'); }
private static void appendHex(java.lang.StringBuilder builder, string s, java.nio.charset.Charset charset) { foreach (byte b in XobotOS.Runtime.Util.GetBytesForString(s, charset)) { appendHex(builder, b); } }
/// <hide>Just for debugging; not internationalized.</hide> public static void formatDuration(long duration, java.lang.StringBuilder builder) { lock (sFormatSync) { int len = formatDurationLocked(duration, 0); builder.append(sFormatStr, 0, len); } }
public static java.lang.String test() { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append('a'); sb.append('\u0062'); sb.append('\x63'); return(sb.toString()); }
/// <summary>Method convert public key String to block format and add a title.</summary> /// <remarks>Method convert public key String to block format and add a title.</remarks> /// <param name="publicKey">String converted to char array and than to block String</param> /// <returns>Return block String of publicKey</returns> public static string printPublicKeyBlock(string publicKey) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("\nPublic Key:\n"); sb.append(CryptobyHelper.charToBlockString(publicKey.ToCharArray())); sb.append(EOB); return(sb.ToString()); }
public virtual void setFormat(string format) { mFormat = format; if (format != null && mFormatBuilder == null) { mFormatBuilder = new java.lang.StringBuilder(format.Length * 2); } }
public StringBuilder(int capacity) { if (capacity < 0) { throw new System.ArgumentOutOfRangeException(); } sb = new java.lang.StringBuilder(capacity); }
// // Format // public static string Format(System.IFormatProvider provider, java.lang.String format, object[] args) { var sb = new java.lang.StringBuilder(); system.text.StringBuilder.AppendFormatHelper(sb, provider, format, args); return(sb.ToString()); }
public static List /*<String>*/ splitWS(string s, bool decode) { ArrayList /*<String>*/ lst = new ArrayList/*<String>*/ (2); java.lang.StringBuilder sb = new java.lang.StringBuilder(); int pos = 0, end = s.Length; while (pos < end) { char ch = s[pos++]; if (java.lang.Character.isWhitespace(ch)) { if (sb.length() > 0) { lst.add(sb.toString()); sb = new java.lang.StringBuilder(); } continue; } if (ch == '\\') { if (!decode) { sb.append(ch); } if (pos >= end) { break; // ERROR, or let it go? } ch = s[pos++]; if (decode) { switch (ch) { case 'n': ch = '\n'; break; case 't': ch = '\t'; break; case 'r': ch = '\r'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; } } } sb.append(ch); } if (sb.length() > 0) { lst.add(sb.toString()); } return(lst); }
private static string ConcatArray(string[] strArray, int resultLength) { javaStringBuilder builder = new javaStringBuilder(resultLength); for (int i = 0; i < strArray.Length; i++) { builder.append(strArray[i]); } return(builder.ToString()); }
public static string Concat(object objA, object objB, object objC, object objD) { var sb = new java.lang.StringBuilder(); AppendIfNotNull(sb, objA); AppendIfNotNull(sb, objB); AppendIfNotNull(sb, objC); AppendIfNotNull(sb, objD); return(sb.ToString()); }
public static string Concat(IEnumerable <string> values) { javaStringBuilder builder = new javaStringBuilder(); foreach (string val in values) { builder.append(val ?? string.Empty); } return(builder.ToString()); }
/// <summary> /// Method merge inputs and add a title to return String which can print /// encrypted text and title in User Interfaces. /// </summary> /// <remarks> /// Method merge inputs and add a title to return String which can print /// encrypted text and title in User Interfaces. /// </remarks> /// <param name="cryptType">Type of cryptology implementation as String</param> /// <param name="inputKeySize">Size of used key as integer</param> /// <param name="inputCharTextHex"> /// Char array of String which will be converted to /// block /// </param> /// <returns>Return String of merged input parameter and text</returns> public static string printHexBlock(string cryptType, int inputKeySize, char[] inputCharTextHex ) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("\n").append(cryptType).append("-").append(inputKeySize).append(" encrypted Text in Hex form (Copy with '" + EOB + "'):\n"); sb.append(CryptobyHelper.charToBlockString(inputCharTextHex)); sb.append(EOB); return(sb.ToString()); }
public static string Concat(string strA, string strB, string strC, string strD) { var sb = new java.lang.StringBuilder(); AppendIfNotNull(sb, strA); AppendIfNotNull(sb, strB); AppendIfNotNull(sb, strC); AppendIfNotNull(sb, strD); return(sb.ToString()); }
public static string Concat <T>(IEnumerable <T> values) { javaStringBuilder builder = new javaStringBuilder(); foreach (T val in values) { string text = val.ToString(); builder.append(text ?? string.Empty); } return(builder.ToString()); }
public override string ToString () { java.lang.StringBuilder sb = new java.lang.StringBuilder (); sb.append ("TypedValue{t=0x").append (Sharpen.Util.IntToHexString (type)); sb.append ("/d=0x").append (Sharpen.Util.IntToHexString (data)); if (type == TYPE_STRING) { java.lang.CharSequence strseq = @string != null ? @string : java.lang.CharSequenceProxy.Wrap ("<null>"); sb.append (" \"").append (strseq).append ("\""); } if (assetCookie != 0) { sb.append (" a=").append (assetCookie); } if (resourceId != 0) { sb.append (" r=0x").append (Sharpen.Util.IntToHexString (resourceId)); } sb.append ("}"); return sb.ToString (); }
/// <summary> /// Method merge inputs and add a title to return String which can print /// encrypted text and title in User Interfaces. /// </summary> /// <remarks> /// Method merge inputs and add a title to return String which can print /// encrypted text and title in User Interfaces. /// </remarks> /// <param name="cryptType">Type of cryptology implementation as String</param> /// <param name="inputKeySize">Size of used key as integer</param> /// <param name="inputCharTextHex"> /// Char array of String which will be converted to /// block /// </param> /// <returns>Return String of merged input parameter and text</returns> public static string printHexBlock(string cryptType, int inputKeySize, char[] inputCharTextHex ) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("\n").append(cryptType).append("-").append(inputKeySize).append(" encrypted Text in Hex form (Copy with '" + EOB + "'):\n"); sb.append(CryptobyHelper.charToBlockString(inputCharTextHex)); sb.append(EOB); return sb.ToString(); }
/// <summary>Returns the next line of text available from this reader.</summary> /// <remarks> /// Returns the next line of text available from this reader. A line is /// represented by zero or more characters followed by /// <code>'\n'</code> /// , /// <code>'\r'</code> /// , /// <code>"\r\n"</code> /// or the end of the reader. The string does /// not include the newline sequence. /// </remarks> /// <returns> /// the contents of the line or /// <code>null</code> /// if no characters were /// read before the end of the reader has been reached. /// </returns> /// <exception cref="IOException">if this reader is closed or some other I/O error occurs. /// </exception> /// <exception cref="System.IO.IOException"></exception> public virtual string readLine() { lock (@lock) { checkNotClosed(); if (pos == end && fillBuf() == -1) { return null; } { for (int charPos = pos; charPos < end; charPos++) { char ch = buf[charPos]; if (ch > '\r') { continue; } if (ch == '\n') { string res = new string(buf, pos, charPos - pos); pos = charPos + 1; return res; } else { if (ch == '\r') { string res = new string(buf, pos, charPos - pos); pos = charPos + 1; if (((pos < end) || (fillBuf() != -1)) && (buf[pos] == '\n')) { pos++; } return res; } } } } char eol = '\0'; java.lang.StringBuilder result = new java.lang.StringBuilder(80); result.append(buf, pos, end - pos); while (true) { pos = end; if (eol == '\n') { return result.ToString(); } // attempt to fill buffer if (fillBuf() == -1) { // characters or null. return result.Length > 0 || eol != '\0' ? result.ToString() : null; } { for (int charPos_1 = pos; charPos_1 < end; charPos_1++) { char c = buf[charPos_1]; if (eol == '\0') { if ((c == '\n' || c == '\r')) { eol = c; } } else { if (eol == '\r' && c == '\n') { if (charPos_1 > pos) { result.append(buf, pos, charPos_1 - pos - 1); } pos = charPos_1 + 1; return result.ToString(); } else { if (charPos_1 > pos) { result.append(buf, pos, charPos_1 - pos - 1); } pos = charPos_1; return result.ToString(); } } } } if (eol == '\0') { result.append(buf, pos, end - pos); } else { result.append(buf, pos, end - pos - 1); } } } }
private void readFieldValues(global::java.lang.Object n1, global::java.io.ObjectStreamClass n2){ //XMLVM_BEGIN_WRAPPER[java.io.ObjectInputStream: void readFieldValues(java.lang.Object, java.io.ObjectStreamClass)] org.xmlvm._nElement _r0; _r0.i = 0; _r0.l = 0; _r0.f = 0; _r0.d = 0; global::System.Object _r0_o = null; org.xmlvm._nElement _r1; _r1.i = 0; _r1.l = 0; _r1.f = 0; _r1.d = 0; global::System.Object _r1_o = null; org.xmlvm._nElement _r2; _r2.i = 0; _r2.l = 0; _r2.f = 0; _r2.d = 0; global::System.Object _r2_o = null; org.xmlvm._nElement _r3; _r3.i = 0; _r3.l = 0; _r3.f = 0; _r3.d = 0; global::System.Object _r3_o = null; org.xmlvm._nElement _r4; _r4.i = 0; _r4.l = 0; _r4.f = 0; _r4.d = 0; global::System.Object _r4_o = null; org.xmlvm._nElement _r5; _r5.i = 0; _r5.l = 0; _r5.f = 0; _r5.d = 0; global::System.Object _r5_o = null; org.xmlvm._nElement _r6; _r6.i = 0; _r6.l = 0; _r6.f = 0; _r6.d = 0; global::System.Object _r6_o = null; org.xmlvm._nElement _r7; _r7.i = 0; _r7.l = 0; _r7.f = 0; _r7.d = 0; global::System.Object _r7_o = null; org.xmlvm._nElement _r8; _r8.i = 0; _r8.l = 0; _r8.f = 0; _r8.d = 0; org.xmlvm._nElement _r9; _r9.i = 0; _r9.l = 0; _r9.f = 0; _r9.d = 0; org.xmlvm._nElement _r10; _r10.i = 0; _r10.l = 0; _r10.f = 0; _r10.d = 0; org.xmlvm._nElement _r11; _r11.i = 0; _r11.l = 0; _r11.f = 0; _r11.d = 0; global::System.Object _r11_o = null; org.xmlvm._nElement _r12; _r12.i = 0; _r12.l = 0; _r12.f = 0; _r12.d = 0; global::System.Object _r12_o = null; org.xmlvm._nElement _r13; _r13.i = 0; _r13.l = 0; _r13.f = 0; _r13.d = 0; global::System.Object _r13_o = null; org.xmlvm._nExceptionAdapter _ex = null; _r11_o = this; _r12_o = n1; _r13_o = n2; _r0_o = ((java.io.ObjectStreamClass) _r13_o).getLoadFields(); if (_r0_o != null) goto label30; _r0.i = 0; _r0_o = new org.xmlvm._nArrayAdapter<global::System.Object>(new global::System.Object[_r0.i]); _r6_o = _r0_o; label10:; _r7_o = ((java.io.ObjectStreamClass) _r13_o).forClass(); if (_r7_o != null) goto label32; _r0.i = ((java.io.ObjectInputStream) _r11_o)._fmustResolve ? 1 : 0; if (_r0.i == 0) goto label32; _r0_o = new java.lang.ClassNotFoundException(); _r1_o = ((java.io.ObjectStreamClass) _r13_o).getName(); ((java.lang.ClassNotFoundException) _r0_o).@this((java.lang.String) _r1_o); throw new org.xmlvm._nExceptionAdapter((java.lang.ClassNotFoundException) _r0_o); label30:; _r6_o = _r0_o; goto label10; label32:; _r8.i = ((org.xmlvm._nIArray) _r6_o).Length; _r0.i = 0; _r9.i = _r0.i; label35:; if (_r9.i < _r8.i) goto label38; return; label38:; _r0_o = ((org.xmlvm._nArrayAdapter<global::System.Object>) _r6_o)[_r9.i]; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); _r2.l = ((java.io.ObjectStreamField) _r0_o).getFieldID((org.xmlvm.runtime.RedTypeMarker) _r1_o, (java.lang.Class) _r7_o); _r1.i = ((java.io.ObjectStreamField) _r0_o).isPrimitive() ? 1 : 0; if (_r1.i == 0) goto label228; try { _r1.i = ((java.io.ObjectStreamField) _r0_o).getTypeCode(); switch (_r1.i) { case 66: goto label80; case 67: goto label98; case 68: goto label116; case 70: goto label135; case 73: goto label153; case 74: goto label171; case 83: goto label190; case 90: goto label209; } _r1_o = new java.io.StreamCorruptedException(); _r2_o = new java.lang.String(); ((java.lang.String)_r2_o).@this(new org.xmlvm._nArrayAdapter<char>("luni.BF".ToCharArray())); _r0.i = ((java.io.ObjectStreamField) _r0_o).getTypeCode(); _r0_o = [email protected]((java.lang.String) _r2_o, (char) _r0.i); ((java.io.StreamCorruptedException) _r1_o).@this((java.lang.String) _r0_o); throw new org.xmlvm._nExceptionAdapter((java.io.StreamCorruptedException) _r1_o); } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label75:; try { _r0_o = _ex.getJavaException(); _ex = null; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label76:; try { _r0.i = _r9.i + 1; _r9.i = _r0.i; goto label35; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label80:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.i = ((java.io.DataInputStream) _r0_o).readByte(); _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setByte throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setByte"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label98:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.i = ((java.io.DataInputStream) _r0_o).readChar(); _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setChar throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setChar"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label116:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r4.d = ((java.io.DataInputStream) _r0_o).readDouble(); _r0.l = -2L; _r0.i = _r2.l > _r0.l ? 1 : (_r2.l == _r0.l ? 0 : -1); if (_r0.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); _r1_o = _r12_o; // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setDouble throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setDouble"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label135:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.f = ((java.io.DataInputStream) _r0_o).readFloat(); _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setFloat throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setFloat"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label153:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.i = ((java.io.DataInputStream) _r0_o).readInt(); _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setInt throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setInt"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label171:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r4.l = ((java.io.DataInputStream) _r0_o).readLong(); _r0.l = -2L; _r0.i = _r2.l > _r0.l ? 1 : (_r2.l == _r0.l ? 0 : -1); if (_r0.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); _r1_o = _r12_o; // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setLong throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setLong"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label190:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.i = ((java.io.DataInputStream) _r0_o).readShort(); _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setShort throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setShort"); goto label76; } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch label209:; try { _r0_o = ((java.io.ObjectInputStream) _r11_o)._finput; _r0.i = ((java.io.DataInputStream) _r0_o).readBoolean() ? 1 : 0; _r4.l = -2L; _r1.i = _r2.l > _r4.l ? 1 : (_r2.l == _r4.l ? 0 : -1); if (_r1.i == 0) goto label76; // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setBoolean throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setBoolean"); } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label75; } throw ex; } // end catch goto label76; label228:; _r1_o = ((java.io.ObjectStreamField) _r0_o).getName(); _r4.i = 0; _r5.i = ((java.io.ObjectInputStream) _r11_o)._fmustResolve ? 1 : 0; if (_r5.i == 0) goto label243; if (_r0_o != null) goto label243; _r4.i = 1; _r5.i = 0; ((java.io.ObjectInputStream) _r11_o)._fmustResolve = 0!=_r5.i; label243:; if (_r0_o == null) goto label339; _r5.i = ((java.io.ObjectStreamField) _r0_o).isUnshared() ? 1 : 0; if (_r5.i == 0) goto label339; _r5_o = ((java.io.ObjectInputStream) _r11_o).readUnshared(); label255:; if (_r4.i == 0) goto label260; _r4.i = 1; ((java.io.ObjectInputStream) _r11_o)._fmustResolve = 0!=_r4.i; label260:; if (_r0_o == null) goto label76; if (_r5_o == null) goto label76; _r0_o = java.io.ObjectInputStream.getFieldClass((java.lang.Object) _r12_o, (java.lang.String) _r1_o); _r4_o = ((java.lang.Object) _r5_o).getClass(); if (_r0_o == null) goto label76; _r10.i = ((java.lang.Class) _r0_o).isAssignableFrom((java.lang.Class) _r4_o) ? 1 : 0; if (_r10.i != 0) goto label344; _r2_o = new java.lang.ClassCastException(); _r3_o = new java.lang.String(); ((java.lang.String)_r3_o).@this(new org.xmlvm._nArrayAdapter<char>("luni.C0".ToCharArray())); _r5.i = 3; _r5_o = new org.xmlvm._nArrayAdapter<global::System.Object>(new global::System.Object[_r5.i]); _r6.i = 0; _r0_o = ((java.lang.Class) _r0_o).toString(); ((org.xmlvm._nArrayAdapter<global::System.Object>) _r5_o)[_r6.i] = _r0_o; _r0.i = 1; _r4_o = ((java.lang.Class) _r4_o).toString(); ((org.xmlvm._nArrayAdapter<global::System.Object>) _r5_o)[_r0.i] = _r4_o; _r0.i = 2; _r4_o = new java.lang.StringBuilder(); _r6_o = ((java.io.ObjectStreamClass) _r13_o).getName(); _r6_o = java.lang.String.valueOf((java.lang.Object) _r6_o); ((java.lang.StringBuilder) _r4_o).@this((java.lang.String) _r6_o); _r6_o = new java.lang.String(); ((java.lang.String)_r6_o).@this(new org.xmlvm._nArrayAdapter<char>(".".ToCharArray())); _r4_o = ((java.lang.StringBuilder) _r4_o).append((java.lang.String) _r6_o); _r1_o = ((java.lang.StringBuilder) _r4_o).append((java.lang.String) _r1_o); _r1_o = ((java.lang.StringBuilder) _r1_o).toString(); ((org.xmlvm._nArrayAdapter<global::System.Object>) _r5_o)[_r0.i] = _r1_o; _r0_o = [email protected]((java.lang.String) _r3_o, (org.xmlvm._nArrayAdapter<global::System.Object>) _r5_o); ((java.lang.ClassCastException) _r2_o).@this((java.lang.String) _r0_o); throw new org.xmlvm._nExceptionAdapter((java.lang.ClassCastException) _r2_o); label339:; _r5_o = ((java.io.ObjectInputStream) _r11_o).readObject(); goto label255; label344:; _r0.l = -2L; _r0.i = _r2.l > _r0.l ? 1 : (_r2.l == _r0.l ? 0 : -1); if (_r0.i == 0) goto label76; try { // Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectInputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor"); // Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setObject throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor setObject"); } catch (org.xmlvm._nExceptionAdapter ex) { global::System.Object _java_exception = ex.getJavaException(); if (_java_exception is java.lang.NoSuchFieldError) { _ex = ex; goto label357; } throw ex; } // end catch goto label76; label357:; _r0_o = _ex.getJavaException(); _ex = null; goto label76; //XMLVM_END_WRAPPER[java.io.ObjectInputStream: void readFieldValues(java.lang.Object, java.io.ObjectStreamClass)] }
/// <summary> /// Quotes the given /// <code>string</code> /// using "\Q" and "\E", so that all /// meta-characters lose their special meaning. This method correctly /// escapes embedded instances of "\Q" or "\E". If the entire result /// is to be passed verbatim to /// <see cref="compile()">compile()</see> /// , it's usually clearer /// to use the /// <see cref="LITERAL">LITERAL</see> /// flag instead. /// </summary> public static string quote(string @string) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("\\Q"); int apos = 0; int k; while ((k = @string.IndexOf("\\E", apos)) >= 0) { sb.append(Sharpen.StringHelper.Substring(@string, apos, k + 2)).append("\\\\E\\Q" ); apos = k + 2; } return sb.append(Sharpen.StringHelper.Substring(@string, apos)).append("\\E").ToString (); }
/// <summary>Inserts the grouping separator every 3 digits.</summary> /// <remarks> /// Inserts the grouping separator every 3 digits. DecimalFormat lets you configure grouping /// size, but you can't access that from Formatter, and the default is every 3 digits. /// </remarks> private java.lang.CharSequence insertGrouping(java.lang.CharSequence s) { java.lang.StringBuilder result = new java.lang.StringBuilder(s.Length + s.Length / 3); // A leading '-' doesn't want to be included in the grouping. int digitsLength = s.Length; int i = 0; if (s[0] == '-') { --digitsLength; ++i; result.append('-'); } // Append the digits that come before the first separator. int headLength = digitsLength % 3; if (headLength == 0) { headLength = 3; } result.append(s, i, i + headLength); i += headLength; // Append the remaining groups. for (; i < s.Length; i += 3) { result.append(localeData.groupingSeparator); result.append(s, i, i + 3); } return result; }
public virtual void setFormat(string format) { mFormat = format; if (format != null && mFormatBuilder == null) { mFormatBuilder = new java.lang.StringBuilder(format.Length * 2); } }
/// <summary> /// Returns a replacement string for the given one that has all backslashes /// and dollar signs escaped. /// </summary> /// <remarks> /// Returns a replacement string for the given one that has all backslashes /// and dollar signs escaped. /// </remarks> /// <param name="s">the input string.</param> /// <returns> /// the input string, with all backslashes and dollar signs having /// been escaped. /// </returns> public static string quoteReplacement(string s) { java.lang.StringBuilder result = new java.lang.StringBuilder(s.Length); { for (int i = 0; i < s.Length; i++) { char c = s[i]; if (c == '\\' || c == '$') { result.append('\\'); } result.append(c); } } return result.ToString(); }
/// <summary>Convert a char array to block format with defined line length.</summary> /// <remarks>Convert a char array to block format with defined line length.</remarks> /// <param name="charTextHex">Char array from a String to convert</param> /// <returns>Return converted block String</returns> public static string charToBlockString(char[] charTextHex) { int lenLine = 64; java.lang.StringBuilder sb = new java.lang.StringBuilder(); char[] temp = new char[lenLine]; for (int i = 0; i < charTextHex.Length; i = i + lenLine) { if ((charTextHex.Length - i) < lenLine) { temp = new char[(charTextHex.Length - i)]; Array.Copy(charTextHex, i, temp, 0, (charTextHex.Length - i)); sb.append(new string(temp)); sb.append("\n"); } else { Array.Copy(charTextHex, i, temp, 0, lenLine); sb.append(new string(temp)); sb.append("\n"); } } return sb.ToString(); }
/// <summary>Method convert public key String to block format and add a title.</summary> /// <remarks>Method convert public key String to block format and add a title.</remarks> /// <param name="publicKey">String converted to char array and than to block String</param> /// <returns>Return block String of publicKey</returns> public static string printPublicKeyBlock(string publicKey) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("\nPublic Key:\n"); sb.append(CryptobyHelper.charToBlockString(publicKey.ToCharArray())); sb.append(EOB); return sb.ToString(); }
/// <returns> /// The label to show for the shortcut. This includes the chording /// key (for example 'Menu+a'). Also, any non-human readable /// characters should be human readable (for example 'Menu+enter'). /// </returns> internal string getShortcutLabel() { char shortcut = getShortcut(); if (shortcut == 0) { return string.Empty; } java.lang.StringBuilder sb = new java.lang.StringBuilder(sPrependShortcutLabel); switch (shortcut) { case '\n': { sb.append(sEnterShortcutLabel); break; } case '\b': { sb.append(sDeleteShortcutLabel); break; } case ' ': { sb.append(sSpaceShortcutLabel); break; } default: { sb.append(shortcut); break; } } return sb.ToString(); }
/// <summary> /// Returns a CharSequence corresponding to /// <code>s</code> /// with all the ASCII digits replaced /// by digits appropriate to this formatter's locale. Other characters remain unchanged. /// </summary> private java.lang.CharSequence localizeDigits(java.lang.CharSequence s) { int length = s.Length; int offsetToLocalizedDigits = localeData.zeroDigit - '0'; java.lang.StringBuilder result = new java.lang.StringBuilder(length); { for (int i = 0; i < length; ++i) { char ch = s[i]; if (ch >= '0' && ch <= '9') { ch += (char)offsetToLocalizedDigits; } result.append(ch); } } return result; }
public static string dump(int[] states) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); int count = states.Length; { for (int i = 0; i < count; i++) { switch (states[i]) { case [email protected]_window_focused: { sb.append("W "); break; } case [email protected]_pressed: { sb.append("P "); break; } case [email protected]_selected: { sb.append("S "); break; } case [email protected]_focused: { sb.append("F "); break; } case [email protected]_enabled: { sb.append("E "); break; } } } } return sb.ToString(); }
public override string ToString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(64); sb.append("Transformation"); toShortString(sb); return sb.ToString(); }
/// <summary>Print a progress bar and percent of progress to console.</summary> /// <remarks> /// Print a progress bar and percent of progress to console. In this format: /// [====================================================================================================] /// 100% /// </remarks> /// <param name="percentProgress"> /// Percent of progress. Integer value has to be /// between 0 and 100. /// </param> public static void printProgressBar(int percentProgress) { if (percentProgress >= 0 || percentProgress <= 100) { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.append("["); for (int i = 0; i < percentProgress; i++) { sb.append("="); } for (int i_1 = 100; i_1 > percentProgress; i_1--) { sb.append("."); } sb.append("] "); sb.append(percentProgress); sb.append("%"); sb.append("\r"); Console.Out.Write(sb.ToString()); } else { Console.Out.Write("Input has to between 0 and 100."); } }
public override string ToString() { java.lang.StringBuilder buf = new java.lang.StringBuilder(); buf.append(GetType().FullName); buf.append(", status: capacity="); buf.append(_capacity); buf.append(" position="); buf.append(_position); buf.append(" limit="); buf.append(_limit); return buf.ToString(); }
public string encode(string s, java.nio.charset.Charset charset) { // Guess a bit larger for encoded form java.lang.StringBuilder builder = new java.lang.StringBuilder(s.Length + 16); appendEncoded(builder, s, charset, false); return builder.ToString(); }
public StringBuilder() { _builder = new java.lang.StringBuilder(); }
/// <param name="convertPlus">true to convert '+' to ' '.</param> public static string decode(string s, bool convertPlus, java.nio.charset.Charset charset) { if (s.IndexOf('%') == -1 && (!convertPlus || s.IndexOf('+') == -1)) { return s; } java.lang.StringBuilder result = new java.lang.StringBuilder(s.Length); java.io.ByteArrayOutputStream @out = new java.io.ByteArrayOutputStream(); { for (int i = 0; i < s.Length; ) { char c = s[i]; if (c == '%') { do { if (i + 2 >= s.Length) { throw new System.ArgumentException("Incomplete % sequence at: " + i); } int d1 = hexToInt(s[i + 1]); int d2 = hexToInt(s[i + 2]); if (d1 == -1 || d2 == -1) { throw new System.ArgumentException("Invalid % sequence " + Sharpen.StringHelper.Substring (s, i, i + 3) + " at " + i); } @out.write(unchecked((byte)((d1 << 4) + d2))); i += 3; } while (i < s.Length && s[i] == '%'); result.append(XobotOS.Runtime.Util.GetStringForBytes(@out.toByteArray(), charset) ); @out.reset(); } else { if (convertPlus && c == '+') { c = ' '; } result.append(c); i++; } } } return result.ToString(); }
public RewriterResults rewrite(Gadget gadget, MutableContent content) { if (gadget.getSpec().getModulePrefs().getFeatures().ContainsKey("caja") || "1".Equals(gadget.getContext().getParameter("caja"))) { URI retrievedUri = gadget.getContext().getUrl(); UriCallback2 cb = new UriCallback2(retrievedUri); MessageQueue mq = new SimpleMessageQueue(); DefaultGadgetRewriter rw = new DefaultGadgetRewriter(mq); CharProducer input = CharProducer.Factory.create( new java.io.StringReader(content.getContent()), FilePosition.instance(new InputSource(new java.net.URI(retrievedUri.ToString())), 2, 1, 1)); java.lang.StringBuilder output = new java.lang.StringBuilder(); try { rw.rewriteContent(new java.net.URI(retrievedUri.ToString()), input, cb, output); } catch (GadgetRewriteException e) { throwCajolingException(e, mq); return RewriterResults.notCacheable(); } catch (IOException e) { throwCajolingException(e, mq); return RewriterResults.notCacheable(); } content.setContent(tameCajaClientApi() + output.ToString()); } return null; }
public string queueAll() { var columns = new [] { KEY_CONTENT }; Cursor cursor = sqLiteDatabase.query(MYDATABASE_TABLE, columns, null, null, null, null, null); var result = new java.lang.StringBuilder(); int index_CONTENT = cursor.getColumnIndex(KEY_CONTENT); for (cursor.moveToFirst(); !(cursor.isAfterLast()); cursor.moveToNext()) { result.append( cursor.getString(index_CONTENT)).append( "\n"); } return result.ToAndroidString(); }
private void maybeLogQueryToEventLog(long durationMillis, System.Uri uri, string[] projection, string selection, string sortOrder) { int samplePercent = samplePercentForDuration(durationMillis); if (samplePercent < 100) { lock (mRandom) { if (Sharpen.Util.Random_NextInt(mRandom, 100) >= samplePercent) { return; } } } java.lang.StringBuilder projectionBuffer = new java.lang.StringBuilder(100); if (projection != null) { { for (int i = 0; i < projection.Length; ++i) { // Note: not using a comma delimiter here, as the // multiple arguments to EventLog.writeEvent later // stringify with a comma delimiter, which would make // parsing uglier later. if (i != 0) { projectionBuffer.append('/'); } projectionBuffer.append(projection[i]); } } } // ActivityThread.currentPackageName() only returns non-null if the // current thread is an application main thread. This parameter tells // us whether an event loop is blocked, and if so, which app it is. string blockingPackage = android.app.AppGlobals.getInitialPackage(); android.util.EventLog.writeEvent(android.content.EventLogTags.CONTENT_QUERY_SAMPLE , uri.ToString(), projectionBuffer.ToString(), selection != null ? selection : string.Empty , sortOrder != null ? sortOrder : string.Empty, durationMillis, blockingPackage != null ? blockingPackage : string.Empty, samplePercent); }
/// <summary> /// Returns the ASCII characters up to but not including the next "\r\n", or /// "\n". /// </summary> /// <remarks> /// Returns the ASCII characters up to but not including the next "\r\n", or /// "\n". /// </remarks> /// <exception cref="java.io.EOFException"> /// if the stream is exhausted before the next newline /// character. /// </exception> /// <exception cref="System.IO.IOException"></exception> public static string readAsciiLine(java.io.InputStream @in) { // TODO: support UTF-8 here instead java.lang.StringBuilder result = new java.lang.StringBuilder(80); while (true) { int c = @in.read(); if (c == -1) { throw new java.io.EOFException(); } else { if (c == '\n') { break; } } result.append((char)c); } int length = result.Length; if (length > 0 && result[length - 1] == '\r') { result.setLength(length - 1); } return result.ToString(); }
/// <summary> /// Combines two arrays (of library names) such that they are /// concatenated in order but are devoid of duplicates. /// </summary> /// <remarks> /// Combines two arrays (of library names) such that they are /// concatenated in order but are devoid of duplicates. The /// result is a single string with the names of the libraries /// separated by colons, or <code>null</code> if both lists /// were <code>null</code> or empty. /// </remarks> /// <param name="list1">null-ok; the first list</param> /// <param name="list2">null-ok; the second list</param> /// <returns>null-ok; the combination</returns> private static string combineLibs(string[] list1, string[] list2) { java.lang.StringBuilder result = new java.lang.StringBuilder(300); bool first = true; if (list1 != null) { foreach (string s in list1) { if (first) { first = false; } else { result.append(':'); } result.append(s); } } // Only need to check for duplicates if list1 was non-empty. bool dupCheck = !first; if (list2 != null) { foreach (string s in list2) { if (dupCheck && [email protected](list1, s)) { continue; } if (first) { first = false; } else { result.append(':'); } result.append(s); } } return result.ToString(); }
public override string ToString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(64); sb.append("Matrix{"); toShortString(sb); sb.append('}'); return sb.ToString(); }
/// <summary>Flatten a byte[] into an XmlSerializer.</summary> /// <remarks> /// Flatten a byte[] into an XmlSerializer. The list can later be read back /// with readThisByteArrayXml(). /// </remarks> /// <param name="val">The byte array to be flattened.</param> /// <param name="name"> /// Name attribute to include with this array's tag, or null for /// none. /// </param> /// <param name="out">XmlSerializer to write the array into.</param> /// <seealso cref="writeMapXml(java.util.Map{K, V}, java.io.OutputStream)">writeMapXml(java.util.Map<K, V>, java.io.OutputStream) /// </seealso> /// <seealso cref="writeValueXml(object, string, org.xmlpull.v1.XmlSerializer)">writeValueXml(object, string, org.xmlpull.v1.XmlSerializer) /// </seealso> /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception> /// <exception cref="System.IO.IOException"></exception> public static void writeByteArrayXml(byte[] val, string name, org.xmlpull.v1.XmlSerializer @out) { if (val == null) { @out.startTag(null, "null"); @out.endTag(null, "null"); return; } @out.startTag(null, "byte-array"); if (name != null) { @out.attribute(null, "name", name); } int N = val.Length; @out.attribute(null, "num", System.Convert.ToString(N)); java.lang.StringBuilder sb = new java.lang.StringBuilder(val.Length * 2); { for (int i = 0; i < N; i++) { int b = val[i]; int h = b >> 4; sb.append(h >= 10 ? ('a' + h - 10) : ('0' + h)); h = b & unchecked((int)(0xff)); sb.append(h >= 10 ? ('a' + h - 10) : ('0' + h)); } } @out.text(sb.ToString()); @out.endTag(null, "byte-array"); }
internal virtual bool setFlag(int ch) { bool dupe = false; switch (ch) { case ',': { dupe = flagComma; flagComma = true; break; } case '-': { dupe = flagMinus; flagMinus = true; break; } case '(': { dupe = flagParenthesis; flagParenthesis = true; break; } case '+': { dupe = flagPlus; flagPlus = true; break; } case '#': { dupe = flagSharp; flagSharp = true; break; } case ' ': { dupe = flagSpace; flagSpace = true; break; } case '0': { dupe = flagZero; flagZero = true; break; } default: { return false; } } if (dupe) { // The RI documentation implies we're supposed to report all the flags, not just // the first duplicate, but the RI behaves the same as we do. throw new java.util.DuplicateFormatFlagsException(ch.ToString()); } if (strFlags == null) { strFlags = new java.lang.StringBuilder(7); } // There are seven possible flags. strFlags.append((char)ch); return true; }
public virtual string toShortString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(64); toShortString(sb); return sb.ToString(); }
private void problem(string message) { if (mViolationMessage == null) { mViolationMessage = new java.lang.StringBuilder(); } if (mViolationMessage.Length == 0) { mViolationMessage.append(mCurrentEventType).append(": "); } else { mViolationMessage.append("\n "); } mViolationMessage.append(message); }