/** * Store a cookie string associated with a url. * * @param url The url to be used as a key for the cookie. * @param value The cookie string to be stored. */ @DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:32:41.967 -0500", hash_original_method = "D5A9FC7DDB356B7F9D175C82B50A2AF1", hash_generated_method = "24C7574FF957618A543446AAAEE4BC4D") private void setCookies(String url, String value) { if (value.contains("\r") || value.contains("\n")) { // for security reason, filter out '\r' and '\n' from the cookie int size = value.length(); StringBuilder buffer = new StringBuilder(size); int i = 0; while (i != -1 && i < size) { int ir = value.indexOf('\r', i); int in = value.indexOf('\n', i); int newi = (ir == -1) ? in : (in == -1 ? ir : (ir < in ? ir : in)); if (newi > i) { buffer.append(value.subSequence(i, newi)); } else if (newi == -1) { buffer.append(value.subSequence(i, size)); break; } i = newi + 1; } value = buffer.toString(); } CookieManager.getInstance().setCookie(url, value); }
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:33:25.523 -0500", hash_original_method = "365F60E44B7DA4848E76578B1D312F6F", hash_generated_method = "D50175F96A203B6C6D18C23FC2D8164A") private void flushBuilder() { if (mBuilder.length() > 0) { Log.println_native(mBuffer, mPriority, mTag, mBuilder.toString()); mBuilder.delete(0, mBuilder.length()); } }
@DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 13:00:57.592 -0500", hash_original_method = "78509CF3CFA7027FFCDFED35C29E300D", hash_generated_method = "0A5AD2537BB87CDDF04EE1FD30A033B2") public void dumpValue(StringBuilder sb, String prefix) { if (generalNames == null) { return; } for (GeneralName generalName : generalNames) { sb.append(prefix); sb.append(generalName); sb.append('\n'); } }
@DSSafe(DSCat.SAFE_LIST) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-06 12:51:00.137 -0400", hash_original_method = "49458D88F683CFC562519CCC6028F4B9", hash_generated_method = "4B5E547FB6FFD5603EAB17A33A903C56") @Override public String toString() { if (mStart == 0 && mEnd == Integer.MAX_VALUE) { return "PageRange[<all pages>]"; } StringBuilder builder = new StringBuilder(); builder.append("PageRange[").append(mStart).append(" - ").append(mEnd).append("]"); return builder.toString(); }
@DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 13:02:32.338 -0500", hash_original_method = "03F9E8D356406A137FAD06FB9E8EE371", hash_generated_method = "B479C1FE28922670A2BCFDF1F907920E") public String toHeaderString() { StringBuilder result = new StringBuilder(256); result.append(statusLine).append("\r\n"); for (int i = 0; i < namesAndValues.size(); i += 2) { result .append(namesAndValues.get(i)) .append(": ") .append(namesAndValues.get(i + 1)) .append("\r\n"); } result.append("\r\n"); return result.toString(); }
/** * Returns {@link StringBuilder#toString()}. * * @return The contents of the String builder. */ @DSSafe(DSCat.SAFE_LIST) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.958 -0400", hash_original_method = "E91A134CF2A6965AC8B4CE2DD48C1D34", hash_generated_method = "D7F9E85DEC15BAB3E09D168F01E1AEF5") @Override public String toString() { return builder.toString(); }
/** * Append a portion of a character sequence to the {@link StringBuilder}. * * @param value The character to append * @param start The index of the first character * @param end The index of the last character + 1 * @return This writer instance */ @DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.955 -0400", hash_original_method = "FBCD01EFCECB3326031D766445C3DB2F", hash_generated_method = "DC5692522586DB5F5BE483B326F0FCF7") @Override public Writer append(CharSequence value, int start, int end) { builder.append(value, start, end); return this; }
/** * Append a character sequence to this Writer. * * @param value The character to append * @return This writer instance */ @DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.954 -0400", hash_original_method = "E2F995DD283D6A0A833AF2D339D19742", hash_generated_method = "B9427F392DE55B9967A3D3DF4534BDBC") @Override public Writer append(CharSequence value) { builder.append(value); return this; }
/** * Append a single character to this Writer. * * @param value The character to append * @return This writer instance */ @DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.954 -0400", hash_original_method = "1288124DBF43C46402FB70C838950E72", hash_generated_method = "AF1DB86BCA89272EBF3D0D2068FF9ECA") @Override public Writer append(char value) { builder.append(value); return this; }
/** * Write a portion of a character array to the {@link StringBuilder}. * * @param value The value to write * @param offset The index of the first character * @param length The number of characters to write */ @DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.957 -0400", hash_original_method = "F2F4EE164E03551E9A5ECDB103942BDC", hash_generated_method = "1693FCC13D24C01A5D1CEE6CB0A4CC1D") @Override public void write(char[] value, int offset, int length) { if (value != null) { builder.append(value, offset, length); } }
/** * Write a String to the {@link StringBuilder}. * * @param value The value to write */ @DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-09-03 14:59:51.956 -0400", hash_original_method = "57CA96DC87E6760D66D655253DABAA82", hash_generated_method = "1E1AEEACBDAE821656E17A3D342272E3") @Override public void write(String value) { if (value != null) { builder.append(value); } }
@DSSink({DSSinkKind.FILE}) @DSSpec(DSCat.IO) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:33:25.521 -0500", hash_original_method = "87C8CDE1CE20D2763C465BB465CBAFDD", hash_generated_method = "72F623F59FC9F90F70CCD532565A22B3") @Override public void write(char[] buf, int offset, int count) { for (int i = 0; i < count; i++) { char c = buf[offset + i]; if (c == '\n') { flushBuilder(); } else { mBuilder.append(c); } } }
/** * Returns a String that is suitable for use as an <code>application/x-www-form-urlencoded</code> * list of parameters in an HTTP PUT or HTTP POST. * * @param parameters The parameters to include. * @param encoding The encoding to use. */ @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 13:01:44.463 -0500", hash_original_method = "FC50720DD3E5D2157039A2F08974D046", hash_generated_method = "DDE2DF273A0113D2EC3E0F3A3C8BCEAE") public static String format( final List<? extends NameValuePair> parameters, final String encoding) { final StringBuilder result = new StringBuilder(); for (final NameValuePair parameter : parameters) { final String encodedName = encode(parameter.getName(), encoding); final String value = parameter.getValue(); final String encodedValue = value != null ? encode(value, encoding) : ""; if (result.length() > 0) result.append(PARAMETER_SEPARATOR); result.append(encodedName); result.append(NAME_VALUE_SEPARATOR); result.append(encodedValue); } return result.toString(); }