/** * Format a String. * @param x The String to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is neither s nor S. */ public String sprintf(String x) throws CmsIllegalArgumentException { Enumeration<ConversionSpecification> e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format an int. * @param x The int to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is f, e, E, g, G, s, * or S. */ public String sprintf(int x) throws CmsIllegalArgumentException { Enumeration<ConversionSpecification> e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format an int. * @param x The int to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is f, e, E, g, G, s, * or S. */ public String sprintf(int x) throws CmsIllegalArgumentException { Enumeration e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = (ConversionSpecification)e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
sb.append(cs.internalsprintf(((Byte)o[i]).byteValue())); } else if (o[i] instanceof Short) { sb.append(cs.internalsprintf(((Short)o[i]).shortValue())); } else if (o[i] instanceof Integer) { sb.append(cs.internalsprintf(((Integer)o[i]).intValue())); } else if (o[i] instanceof Long) { sb.append(cs.internalsprintf(((Long)o[i]).longValue())); } else if (o[i] instanceof Float) { sb.append(cs.internalsprintf(((Float)o[i]).floatValue())); } else if (o[i] instanceof Double) { sb.append(cs.internalsprintf(((Double)o[i]).doubleValue())); } else if (o[i] instanceof Character) { sb.append(cs.internalsprintf(((Character)o[i]).charValue())); } else if (o[i] instanceof String) { sb.append(cs.internalsprintf((String)o[i])); } else { sb.append(cs.internalsprintf(o[i]));
sb.append(cs.internalsprintf(((Byte)o[i]).byteValue())); } else if (o[i] instanceof Short) { sb.append(cs.internalsprintf(((Short)o[i]).shortValue())); } else if (o[i] instanceof Integer) { sb.append(cs.internalsprintf(((Integer)o[i]).intValue())); } else if (o[i] instanceof Long) { sb.append(cs.internalsprintf(((Long)o[i]).longValue())); } else if (o[i] instanceof Float) { sb.append(cs.internalsprintf(((Float)o[i]).floatValue())); } else if (o[i] instanceof Double) { sb.append(cs.internalsprintf(((Double)o[i]).doubleValue())); } else if (o[i] instanceof Character) { sb.append(cs.internalsprintf(((Character)o[i]).charValue())); } else if (o[i] instanceof String) { sb.append(cs.internalsprintf((String)o[i])); } else { sb.append(cs.internalsprintf(o[i]));
} else { if (x instanceof Byte) { sb.append(cs.internalsprintf(((Byte)x).byteValue())); } else if (x instanceof Short) { sb.append(cs.internalsprintf(((Short)x).shortValue())); } else if (x instanceof Integer) { sb.append(cs.internalsprintf(((Integer)x).intValue())); } else if (x instanceof Long) { sb.append(cs.internalsprintf(((Long)x).longValue())); } else if (x instanceof Float) { sb.append(cs.internalsprintf(((Float)x).floatValue())); } else if (x instanceof Double) { sb.append(cs.internalsprintf(((Double)x).doubleValue())); } else if (x instanceof Character) { sb.append(cs.internalsprintf(((Character)x).charValue())); } else if (x instanceof String) { sb.append(cs.internalsprintf((String)x)); } else { sb.append(cs.internalsprintf(x));
} else { if (x instanceof Byte) { sb.append(cs.internalsprintf(((Byte)x).byteValue())); } else if (x instanceof Short) { sb.append(cs.internalsprintf(((Short)x).shortValue())); } else if (x instanceof Integer) { sb.append(cs.internalsprintf(((Integer)x).intValue())); } else if (x instanceof Long) { sb.append(cs.internalsprintf(((Long)x).longValue())); } else if (x instanceof Float) { sb.append(cs.internalsprintf(((Float)x).floatValue())); } else if (x instanceof Double) { sb.append(cs.internalsprintf(((Double)x).doubleValue())); } else if (x instanceof Character) { sb.append(cs.internalsprintf(((Character)x).charValue())); } else if (x instanceof String) { sb.append(cs.internalsprintf((String)x)); } else { sb.append(cs.internalsprintf(x));
/** * Format an long. * @param x The long to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is f, e, E, g, G, s, * or S. */ public String sprintf(long x) throws CmsIllegalArgumentException { Enumeration<ConversionSpecification> e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format a double. * @param x The double to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is c, C, s, S, * d, d, x, X, or o. */ public String sprintf(double x) throws CmsIllegalArgumentException { Enumeration<ConversionSpecification> e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format a double. * @param x The double to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is c, C, s, S, * d, d, x, X, or o. */ public String sprintf(double x) throws CmsIllegalArgumentException { Enumeration e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = (ConversionSpecification)e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format a String. * @param x The String to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is neither s nor S. */ public String sprintf(String x) throws CmsIllegalArgumentException { Enumeration e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = (ConversionSpecification)e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }
/** * Format an long. * @param x The long to format. * @return The formatted String. * @exception CmsIllegalArgumentException if the * conversion character is f, e, E, g, G, s, * or S. */ public String sprintf(long x) throws CmsIllegalArgumentException { Enumeration e = m_vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { cs = (ConversionSpecification)e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') { sb.append(cs.getLiteral()); } else if (c == '%') { sb.append("%"); } else { sb.append(cs.internalsprintf(x)); } } return sb.toString(); }