List of usage examples for java.lang StringBuffer toString
@Override @HotSpotIntrinsicCandidate public synchronized String toString()
From source file:com.googlesource.gerrit.plugins.supermanifest.StringUtil.java
public static String addTab(String str) { StringBuffer buf = new StringBuffer(""); for (String s : str.split("\n")) { if (!s.trim().isEmpty()) { buf.append("\t" + s + " \n"); }/* w w w . j a v a2s .c o m*/ } return buf.toString(); }
From source file:Main.java
public static boolean isAccessibilityServiceOn(Context context, String packageName, String className) { ArrayList<String> allAccessibilityServices = getAllAccessibilityServices(context); StringBuffer concat = new StringBuffer(); concat.append(packageName);/*w w w . jav a 2s. co m*/ concat.append('/'); concat.append(className); return allAccessibilityServices.contains(concat.toString()); }
From source file:Main.java
public static String addAttribute(String p_name, String p_value) { StringBuffer l_buf = null; if (p_value != null) { l_buf = new StringBuffer(); l_buf.append(" ").append(p_name).append("=\""); l_buf.append(p_value).append("\""); return l_buf.toString(); }/*from www . ja va 2s .co m*/ return ""; }
From source file:Main.java
/** * @return/*from w w w . ja v a2 s .c o m*/ * @throws IOException */ public static String getDataFromFile(String dataFileName) throws IOException { FileInputStream inputStream = null; try { inputStream = new FileInputStream(dataFileName); } catch (IOException e) { e.printStackTrace(); } String _jsonGspTxt = null; if (inputStream != null) { BufferedReader myReader = new BufferedReader(new InputStreamReader(inputStream)); String _row = ""; StringBuffer _buffer = new StringBuffer(); while ((_row = myReader.readLine()) != null) { _buffer.append(_row); } _jsonGspTxt = _buffer.toString(); // _fIn.close(); myReader.close(); } else { throw new FileNotFoundException(); } return _jsonGspTxt; }
From source file:Main.java
protected static String generateRandomString(int demoLength) { String base = "abcdefghijklmnopqrstuvwxyz"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < demoLength; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number));/*from w ww .j a v a 2 s.c o m*/ } return sb.toString(); }
From source file:com.autentia.intra.util.BeanUtils.java
/** * Devuelve la pila de una excepcion//from ww w . j a v a 2s. c om * * @param ex la excepcion * @return la pila de la excepcion */ public static String getErrorDesc(Throwable ex) { StringBuffer sb = new StringBuffer(); StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); sb.append(sw.toString()); return sb.toString(); }
From source file:Main.java
public static String formatPhone(String number) { StringBuffer sb = new StringBuffer(); char c;//from w w w . j a v a 2 s. co m for (int i = 0; i < number.length(); i++) { c = number.charAt(i); if (48 <= c && c <= 57) sb.append(c); } return sb.toString(); }
From source file:Util.java
/** * Converts a String array to an String, joined by the Seperator * * @param items The String Array to Join * @param seperator The Seperator used to join the String * @return The Joined String/*from w w w . jav a 2 s. co m*/ */ public static String arrayToString(String[] items, String seperator) { if ((items == null) || (items.length == 0)) { return ""; } else { StringBuffer buffer = new StringBuffer(items[0]); for (int i = 1; i < items.length; i++) { buffer.append(seperator); buffer.append(items[i]); } return buffer.toString(); } }
From source file:com.gson.util.Tools.java
public static final String inputStream2String(InputStream in) throws UnsupportedEncodingException, IOException { if (in == null) return ""; StringBuffer out = new StringBuffer(); byte[] b = new byte[4096]; for (int n; (n = in.read(b)) != -1;) { out.append(new String(b, 0, n, "UTF-8")); }/*w w w. j a v a2s . co m*/ return out.toString(); }
From source file:com.isoftstone.crawl.template.utils.OutputErrorData.java
/** * //w w w. j a va 2 s. c o m * * @param list * @return String */ public synchronized static String joinString(List<String> list) { StringBuffer buffer = new StringBuffer(); for (String msg : list) { buffer.append(msg).append(WebtoolConstants.WRAP); } return buffer.toString(); }