List of usage examples for java.lang StringBuffer append
@Override public synchronized StringBuffer append(double d)
From source file:Main.java
public static String getDesc(Constructor<?> paramConstructor) { StringBuffer localStringBuffer = new StringBuffer(); localStringBuffer.append("("); Class[] arrayOfClass = paramConstructor.getParameterTypes(); for (int i = 0; i < arrayOfClass.length; i++) { localStringBuffer.append(getDesc(arrayOfClass[i])); }/* www . jav a2 s. c om*/ localStringBuffer.append(")V"); return localStringBuffer.toString(); }
From source file:Main.java
public static String readerToString(Reader r) throws Exception { //Read into string StringBuffer buff = new StringBuffer(); int c;/* ww w . j a v a2s. c o m*/ while ((c = r.read()) != -1) { buff.append((char) c); } return buff.toString(); }
From source file:Main.java
public static String getNowDate() { StringBuffer sbBuffer = new StringBuffer(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sbBuffer.append(format.format(Calendar.getInstance().getTime())); return sbBuffer.toString(); }
From source file:Main.java
public static String md5(String s) { if (null == digest) return ""; // Create MD5 Hash digest.reset();//from w ww . j a v a 2 s . com digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) hexString.append(Integer.toHexString(0xFF & messageDigest[i])); return hexString.toString(); }
From source file:Main.java
/** * Builds a bracketed CSV list from the array * @param array an array of Objects/* w ww. j a v a2 s . com*/ * @return string */ public static String arrayToString(Object array) { int len = Array.getLength(array); int last = len - 1; StringBuffer sb = new StringBuffer(2 * (len + 1)); sb.append('{'); for (int i = 0; i < len; i++) { sb.append(Array.get(array, i)); if (i != last) { sb.append(','); } } sb.append('}'); return sb.toString(); }
From source file:Main.java
public static String addGetString(String fieldName) { StringBuffer sb = new StringBuffer(); if (fieldName.startsWith("is")) { return fieldName; }//from w ww . ja v a 2 s. c o m sb.append("get"); sb.append(fieldName.substring(0, 1).toUpperCase()); sb.append(fieldName.substring(1)); return sb.toString(); }
From source file:Main.java
public static String getPageExtensionList() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < pageExtensions.length; ++i) { buf.append('.'); buf.append(pageExtensions[i]);/*ww w.j av a 2s . co m*/ if (i != pageExtensions.length - 1) { buf.append(", "); //$NON-NLS-1$ } } return buf.toString(); }
From source file:com.aw.core.dao.bean.sql.BeanSqlBuilder.java
protected static void buildColEqValue(BeanMetaInfo.ColumnInfo columnInfo, Object colValue, StringBuffer sqlPart, List params) {//from ww w. jav a2 s. co m sqlPart.append(buildColName(columnInfo)); sqlPart.append("="); sqlPart.append("?"); params.add(colValue); }
From source file:com.digitalpebble.storm.crawler.protocol.AbstractHttpProtocol.java
protected static String getAgentString(String agentName, String agentVersion, String agentDesc, String agentURL, String agentEmail) {/* w w w.ja v a 2s .com*/ StringBuffer buf = new StringBuffer(); buf.append(agentName); if (StringUtils.isNotBlank(agentVersion)) { buf.append("/"); buf.append(agentVersion); } boolean hasAgentDesc = StringUtils.isNotBlank(agentDesc); boolean hasAgentURL = StringUtils.isNotBlank(agentURL); boolean hasAgentEmail = StringUtils.isNotBlank(agentEmail); if (hasAgentDesc || hasAgentEmail || hasAgentURL) { buf.append(" ("); if (hasAgentDesc) { buf.append(agentDesc); if (hasAgentURL || hasAgentEmail) buf.append("; "); } if (hasAgentURL) { buf.append(agentURL); if (hasAgentEmail) buf.append("; "); } if (hasAgentEmail) { buf.append(agentEmail); } buf.append(")"); } return buf.toString(); }
From source file:Main.java
public static String getDesc(Method paramMethod) { StringBuffer localStringBuffer = new StringBuffer(); localStringBuffer.append("("); Class[] arrayOfClass = paramMethod.getParameterTypes(); for (int i = 0; i < arrayOfClass.length; i++) { localStringBuffer.append(getDesc(arrayOfClass[i])); }/*from ww w .java 2 s.c o m*/ localStringBuffer.append(")"); localStringBuffer.append(getDesc(paramMethod.getReturnType())); return localStringBuffer.toString(); }