List of usage examples for java.lang StringBuffer toString
@Override @HotSpotIntrinsicCandidate public synchronized String toString()
From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.HibernateTypeUtils.java
public static void logBind(Logger log, int index, Object value) { if (log.isDebugEnabled()) { StringBuffer msg = new StringBuffer("binding "); appendBoundValue(value, msg);//from w w w. j av a2 s . c o m msg.append(" to parameter: ").append(index); log.debug(msg.toString()); } }
From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.HibernateTypeUtils.java
public static void logReturn(Logger log, String column, Object value) { if (log.isDebugEnabled()) { StringBuffer msg = new StringBuffer("returning "); appendBoundValue(value, msg);/*from w ww .ja va 2s .c om*/ msg.append(" as column: ").append(column); log.debug(msg.toString()); } }
From source file:Main.java
public static String getRandom(int num) { StringBuffer sbf = new StringBuffer(); for (int i = 0; i < num; i++) { int random = (int) (Math.random() * (RANDOMS.length())); sbf.append(RANDOMS.charAt(random)); }// w ww . j a v a 2 s . com return sbf.toString(); }
From source file:Main.java
public static String toMacFormat(String mac) { if (mac.length() == 12) { StringBuffer sb = new StringBuffer(mac); sb.insert(10, ':'); sb.insert(8, ':'); sb.insert(6, ':'); sb.insert(4, ':'); sb.insert(2, ':'); return sb.toString(); }//from w w w .j a v a2 s .c o m return ""; }
From source file:org.springextensions.db4o.ObjectServerUtils.java
/** * utility method used for masking the password with '*'. * * @param string//from w w w. j a v a 2 s . c o m * @return */ public static String maskString(String string) { StringBuffer buf = new StringBuffer(string.length()); for (int i = 0; i < string.length(); i++) { buf.append('*'); } return buf.toString(); }
From source file:Main.java
public static String toMD5(String md5) { try {// w w w . j a va 2s .c om java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException e) { } return null; }
From source file:Main.java
public static String readTextFromSDcard(InputStream is) throws Exception { InputStreamReader reader = new InputStreamReader(is); BufferedReader bufferedReader = new BufferedReader(reader); StringBuffer buffer = new StringBuffer(""); String str;//from w w w.j a v a2 s . c o m while ((str = bufferedReader.readLine()) != null) { buffer.append(str); buffer.append("\n"); } return buffer.toString(); }
From source file:com.siniatech.siniautils.file.PathHelper.java
static public String getFileContents(Path file) throws IOException { try (BufferedReader in = newBufferedReader(file, Charset.defaultCharset())) { StringBuffer sb = new StringBuffer(); String line;/*from www . j a v a 2s .c o m*/ while ((line = in.readLine()) != null) { sb.append(line); } return sb.toString(); } }
From source file:Main.java
public static String getPrettyString(Collection<?> coll) { StringBuffer sb = new StringBuffer(); Iterator<?> it = coll.iterator(); while (it.hasNext()) { String s = it.next().toString(); sb.append(s + "\n"); }/*from ww w . j av a 2s . c om*/ return sb.toString().trim(); }
From source file:Main.java
public static String MD5(String md5) { try {/*from w ww . j a va 2 s .c o m*/ MessageDigest md = MessageDigest.getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (NoSuchAlgorithmException e) { } return null; }