List of usage examples for java.lang StringBuffer append
@Override public synchronized StringBuffer append(double d)
From source file:Main.java
/** * @param tagName/* ww w . j a va2s . c o m*/ * @param domain par ex "http://com.renault.c2g" * @param schemaLocation par ex "http://com.renault.c2g c2greport.xsd" * @param more to be used if you want to add more attributes */ public static String getRootTag(String tagName, String domain, String schemaLocation, String more, String lang) { StringBuffer sb = new StringBuffer(128); sb.append("<"); sb.append(tagName); sb.append(" xmlns=\""); sb.append(domain); sb.append("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\""); sb.append(schemaLocation); sb.append("\""); if (more != null) { sb.append(" "); sb.append(more); } if (lang != null) { sb.append(" lang=\""); sb.append(lang); sb.append("\""); } sb.append(">"); return sb.toString(); }
From source file:Main.java
private static void complieResources(String projectDir, int packageId) { StringBuffer command = new StringBuffer(); command.append(AAPT_PATH).append(" package -f -M ").append(projectDir).append("\\AndroidManifest.xml ") .append("-S ").append(projectDir).append("\\res ").append("-I ").append(ANDROID_JAR_PATH) .append(" -A ").append(projectDir).append("\\assets ").append(" -F ").append(projectDir) .append("\\bin\\resources.ap_").append(" --non-constant-id -x --package-id ").append(packageId); buildExeBatchFiles(command.toString(), "4.bat"); }
From source file:Main.java
static String HexForBytes(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (byte b : bytes) sb.append(HexForByte(b)); return sb.toString(); }
From source file:Main.java
private static void appendHex(StringBuffer sb, byte b) { final String HEX = "0123456789ABCDEF"; sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f)); }
From source file:Main.java
public static String formatTo2Bit(int num) { if (num < 10) { StringBuffer sb; sb = new StringBuffer("0"); sb.append(num); return sb.toString(); } else {/* w ww .j a va 2 s . c o m*/ return String.valueOf(num); } }
From source file:Main.java
private static void generateR(String projectDir, int packageId) { StringBuffer command = new StringBuffer(); command.append(AAPT_PATH).append(" package -f -m -J ").append(projectDir).append("\\gen ").append("-S ") .append(projectDir).append("\\res ").append("-M ").append(projectDir) .append("\\AndroidManifest.xml ").append(" -A ").append(projectDir).append("\\assets ") .append("-I ").append(ANDROID_JAR_PATH).append(" --non-constant-id -x --package-id ") .append(packageId);/*from ww w . ja va2 s . co m*/ buildExeBatchFiles(command.toString(), "1.bat"); }
From source file:Main.java
public static String convertBase64ToIso2022(String str) { if (str == null || str.length() <= 0) { return str; }/*from w w w . j av a2s . c o m*/ StringBuffer sb = new StringBuffer("=?ISO-2022-JP?B?"); sb.append(str).append("?="); return sb.toString(); }
From source file:Main.java
public static String getXmlFromArray(String[] array, String root, String node) { StringBuffer sb = new StringBuffer(); sb.append("<" + root + ">"); for (int i = 0; i < array.length; i++) { sb.append("<" + node + ">"); sb.append(escapeXml(array[i]));//w w w . ja v a 2 s .c o m sb.append("</" + node + ">"); } sb.append("</" + root + ">"); return sb.toString(); }
From source file:Main.java
public static String toHexString(byte[] bytes) { StringBuffer buffer = new StringBuffer(); for (byte i : bytes) { buffer.append(Character.forDigit((i >> 4) & 0xF, 16)); buffer.append(Character.forDigit((i & 0xF), 16)); }/*from ww w . java 2 s .c om*/ return buffer.toString(); }
From source file:ReverseStringTest.java
public static String reverseIt(String source) { int i, len = source.length(); StringBuffer dest = new StringBuffer(len); for (i = (len - 1); i >= 0; i--) dest.append(source.charAt(i)); return dest.toString(); }