MaskFormat extends Format implements FormatProvider { public static String format(String mask, String str) { return format(mask, str, DEFAULT_PLACEHOLDER); } MaskFormat();  MaskFormat(String mask);  MaskFormat(String mask, char placeholder); static FormatFactory factory(); static String format(String mask, String str); static String format(String mask, String str, char placeholder); static String parse(String mask, String source); static String parse(String mask, String source, char placeholder); StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); String format(String str); @Override FormatFactory getFactory(); @Override String getFormatName(); String getMask(); char getPlaceholder(); String parse(String source); String parse(String source, ParsePosition pos); Object parseObject(String source); Object parseObject(String source, ParsePosition pos); void setMask(String mask); void setPlaceholder(char placeholder);  }
@Test public void messageFmtTest() { MessageFormat msg = new MessageFormat("Hello {0}"); msg.setFormat(0, new MaskFormat("__ ____|_")); Assert.assertEquals(msg.render("001100Z"), "Hello 00 1100|Z"); java.text.MessageFormat smsg = new java.text.MessageFormat("Hello {0}"); smsg.setFormat(0, new MaskFormat("__ ____|_")); Assert.assertEquals(smsg.format(new String[] { "001100Z" }), "Hello 00 1100|Z"); }