List of usage examples for java.lang StringBuffer append
@Override public synchronized StringBuffer append(double d)
From source file:egovframework.com.utl.wed.filter.DirectoryPathManager.java
/** * 2012/12/22///from ww w. j av a 2 s.c o m * @param dateType * @return * @throws InvalidArgumentException */ public static String getDirectoryPathByDateType(DIR_DATE_TYPE policy) { Calendar calendar = Calendar.getInstance(); StringBuffer sb = new StringBuffer(); sb.append(calendar.get(Calendar.YEAR)).append(File.separator); if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM.ordinal()) { sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH)), 2, '0')) .append(File.separator); } if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM_DD.ordinal()) { sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.DATE)), 2, '0')) .append(File.separator); } return sb.toString(); }
From source file:Main.java
public static String maskString(final String str) { final StringBuffer buf = new StringBuffer(str.length()); for (int i = 0; i < str.length(); i++) { buf.append("*"); }/*from www . j a va 2s . c om*/ return buf.toString(); }
From source file:Main.java
public static String getHexString(byte[] messageid) { StringBuffer sb = new StringBuffer(); if (messageid.length > 0) { for (byte b : messageid) { sb.append(String.format("%02X", b)); }// w w w. ja va 2 s .c om } return sb.toString(); }
From source file:Main.java
private static String generateInStr(String[] values, String quote) { StringBuffer buffer = new StringBuffer("( "); int i;//from w w w. j a v a 2s .c om for (i = 0; i < values.length - 1; i++) buffer.append(quote + values[i] + quote + ", "); buffer.append(quote + values[i] + quote + " )"); return buffer.toString(); }
From source file:Main.java
/** * Give the String representation of an Attribute name. * //from www. ja v a2 s . c om * @param pAttribute * the attribute * @return String representation of the attribute name. */ public static String attributeNameToString(Attribute pAttribute) { StringBuffer fullAttribute = new StringBuffer(); if (pAttribute.getName().getPrefix() != null) { fullAttribute.append(pAttribute.getName().getPrefix()); fullAttribute.append(":"); } fullAttribute.append(pAttribute.getName().getLocalPart()); return fullAttribute.toString(); }
From source file:Main.java
/** * Convert a XML starting tag to a String *//*from ww w . j a v a2 s . co m*/ static String convertStartTagToString(String p_localName, Attributes p_attrs) { StringBuffer output = new StringBuffer(START_TAG_STRING_BUFFER_LENGTH); output.append("<"); output.append(p_localName); if (p_attrs != null) { int size = p_attrs.getLength(); for (int i = 0; i < size; i++) { output.append(" "); output.append(p_attrs.getQName(i)); output.append("=\""); output.append(p_attrs.getValue(i)); output.append("\""); } } output.append(">"); return output.toString(); }
From source file:Main.java
public static String byteArrayToHexString(byte[] b) { StringBuffer sb = new StringBuffer(b.length * 2); for (int i = 0; i < b.length; i++) { int v = b[i] & 0xff; if (v < 16) { sb.append('0'); }/* w w w.j ava 2 s . c o m*/ sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); }
From source file:Main.java
/** * Used to write out an attribute for an element. Surrounding whitespace will * not be added to the buffer. The given value will be XML encoded before * appending to the buffer.// w w w . j a v a 2s .c om * <p> * For example, given attrName="foo" and attrValue="val<bar" writes out: * <pre>foo="val&lt;bar"</pre> * * @param attrName the attribute name * @param attrValue the attribute value * @param buf the {@code StringBuffer} to which to append the attribute * * @deprecated - Use {@link #xmlAppendAttr(String, String, Appendable)}. */ @Deprecated public static void xmlAppendAttrValuePair(String attrName, String attrValue, StringBuffer buf) { buf.append(attrName); buf.append("=\""); XmlEncodeAttrValue(attrValue, buf); buf.append('"'); }
From source file:Main.java
public static String toXML(String valor) { StringBuffer str = new StringBuffer(); for (int i = 0; i < valor.length(); ++i) str.append(toXML(valor.charAt(i))); return str.toString(); }
From source file:Main.java
public static String toCsv(String[] array) { StringBuffer result = new StringBuffer(); for (int s = 0; s < array.length; s++) { if (s > 0) result.append(", "); result.append(array[s]);//from w w w . j av a 2 s . c o m } return result.toString(); }