List of usage examples for java.lang StringBuilder toString
@Override
@HotSpotIntrinsicCandidate
public String toString()
From source file:Main.java
private static String read(InputStream instream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(instream)); StringBuilder builder = new StringBuilder(); String line;/*from www .ja v a 2 s. c o m*/ while ((line = reader.readLine()) != null) { builder.append(line); } return builder.toString(); }
From source file:Main.java
public static String readStringFromInputStream(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder body = new StringBuilder(); String line;//from w w w . j a va 2 s . co m while ((line = rd.readLine()) != null) { body.append(line); } return body.toString(); }
From source file:Main.java
public static String maskString(String paramString) { StringBuilder localStringBuilder = new StringBuilder(paramString.length()); for (int i = 0; i < paramString.length(); i++) localStringBuilder.append("*"); return localStringBuilder.toString(); }
From source file:Main.java
public static String getPublicDataFolder() { StringBuilder publicFolder = new StringBuilder(); publicFolder.append(Environment.getExternalStorageDirectory()).append(DIRECTORY_NAME); File new_dir = new File(publicFolder.toString()); if (!new_dir.exists()) { new_dir.mkdirs(); }/* ww w . j av a2 s . c o m*/ return publicFolder.toString(); }
From source file:Main.java
public static String bytesToString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length); for (int i = 0; i < bytes.length; i++) { sb.append(String.valueOf(bytes[i])).append(" "); }// www .ja va 2s . c o m return sb.toString(); }
From source file:Main.java
public static <T> String mkString(String separator, T... ss) { if (ss.length == 0) return ""; StringBuilder sb = new StringBuilder(); sb.append(ss[0]);/*from ww w. j av a2 s . c om*/ for (int i = 1; i < ss.length; i++) sb.append(separator).append(ss[i]); return sb.toString(); }
From source file:Main.java
public static String readInputStream(InputStream i) throws IOException { BufferedInputStream s = new BufferedInputStream(i); byte[] buf = new byte[512]; int len = -1; StringBuilder sb = new StringBuilder(); while ((len = s.read(buf, 0, buf.length)) != -1) { sb.append(new String(buf, 0, len)); }/*from w w w . j a v a2 s . c o m*/ return sb.toString(); }
From source file:Main.java
public static String printBundle(Bundle bundle) { StringBuilder sb = new StringBuilder(); for (String key : bundle.keySet()) { sb.append("\nkey:" + key + ", value:" + bundle.getString(key)); }//www.java 2 s . c om return sb.toString(); }
From source file:Main.java
public static String floatArrayToStringWithRadToDeg(float[] array) { StringBuilder builder = new StringBuilder(); for (float v : array) { builder.append("" + 57.295776f * v + " "); }//w w w . j a va2s .c om builder.append("\n"); return builder.toString(); }
From source file:Strings.java
/** * Returns <code>true</code> if the specified buffer contains * only whitespace characters.// w w w. j a v a2 s . com * * @param sb String buffer to test for whitespace. * @return <code>true</code> if the specified buffer contains only * whitespace characters. */ public static boolean allWhitespace(StringBuilder sb) { return allWhitespace(sb.toString()); }