Java Doc for MessageFormat.java in  » Apache-Harmony-Java-SE » java-package » java » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      java.text.MessageFormat

MessageFormat
public class MessageFormat extends Format (Code)
MessageFormat is used to format and parse arguments based on a pattern. The pattern specifies how each argument will be formatted and concatenated with other text to produce the formatted output.

Inner Class :public static class Field extends Format.Field


Constructor Summary
public  MessageFormat(String template, Locale locale)
     Constructs a new MessageFormat using the specified pattern and the specified Locale for Formats.
public  MessageFormat(String template)
     Constructs a new MessageFormat using the specified pattern and the default Locale for Formats.

Method Summary
public  voidapplyPattern(String template)
     Changes this MessageFormat to use the specified pattern.
public  Objectclone()
     Answers a new instance of MessageFormat with the same pattern and Formats as this MessageFormat.
public  booleanequals(Object object)
     Compares the specified object to this MessageFormat and answer if they are equal.
final public  StringBufferformat(Object[] objects, StringBuffer buffer, FieldPosition field)
     Formats the Object arguments into the specified StringBuffer using the pattern of this MessageFormat.

If Field Attribute of the FieldPosition supplied is MessageFormat.Field.ARGUMENT, then begin and end index of this field position is set to the location of the first occurrence of a message format argument.

final public  StringBufferformat(Object object, StringBuffer buffer, FieldPosition field)
     Formats the specified object into the specified StringBuffer using the pattern of this MessageFormat.
public static  Stringformat(String template, Object... objects)
     Formats the Object arguments using the specified MessageFormat pattern.
public  AttributedCharacterIteratorformatToCharacterIterator(Object object)
     Formats the specified object using the rules of this MessageFormat and returns an AttributedCharacterIterator with the formatted message and attributes.
public  Format[]getFormats()
     Answers the Formats of this MessageFormat.
public  Format[]getFormatsByArgumentIndex()
     Answers the formats used for each argument index.
public  LocalegetLocale()
     Answers the Locale used when creating Formats.
public  inthashCode()
     Answers an integer hash code for the receiver.
public  Object[]parse(String string)
     Parse the message arguments from the specified String using the rules of this MessageFormat.
public  Object[]parse(String string, ParsePosition position)
     Parse the message argument from the specified String starting at the index specified by the ParsePosition.
public  ObjectparseObject(String string, ParsePosition position)
     Parse the message argument from the specified String starting at the index specified by the ParsePosition.
public  voidsetFormat(int offset, Format format)
     Sets the specified Format used by this MessageFormat.
public  voidsetFormatByArgumentIndex(int argIndex, Format format)
    
public  voidsetFormats(Format[] formats)
     Sets the Formats used by this MessageFormat.
public  voidsetFormatsByArgumentIndex(Format[] formats)
     Sets the formats used for each argument The formats array elements should be in the order of the argument indices.
public  voidsetLocale(Locale locale)
     Sets the Locale to use when creating Formats.
public  StringtoPattern()
     Answers the pattern of this MessageFormat.


Constructor Detail
MessageFormat
public MessageFormat(String template, Locale locale)(Code)
Constructs a new MessageFormat using the specified pattern and the specified Locale for Formats.
Parameters:
  template - the pattern
Parameters:
  locale - the locale
exception:
  IllegalArgumentException - when the pattern cannot be parsed



MessageFormat
public MessageFormat(String template)(Code)
Constructs a new MessageFormat using the specified pattern and the default Locale for Formats.
Parameters:
  template - the pattern
exception:
  IllegalArgumentException - when the pattern cannot be parsed




Method Detail
applyPattern
public void applyPattern(String template)(Code)
Changes this MessageFormat to use the specified pattern.
Parameters:
  template - the pattern
exception:
  IllegalArgumentException - when the pattern cannot be parsed



clone
public Object clone()(Code)
Answers a new instance of MessageFormat with the same pattern and Formats as this MessageFormat. a shallow copy of this MessageFormat
See Also:   java.lang.Cloneable



equals
public boolean equals(Object object)(Code)
Compares the specified object to this MessageFormat and answer if they are equal. The object must be an instance of MessageFormat and have the same pattern.
Parameters:
  object - the object to compare with this object true if the specified object is equal to this MessageFormat,false otherwise
See Also:   MessageFormat.hashCode



format
final public StringBuffer format(Object[] objects, StringBuffer buffer, FieldPosition field)(Code)
Formats the Object arguments into the specified StringBuffer using the pattern of this MessageFormat.

If Field Attribute of the FieldPosition supplied is MessageFormat.Field.ARGUMENT, then begin and end index of this field position is set to the location of the first occurrence of a message format argument. Otherwise the FieldPosition is ignored


Parameters:
  objects - the array of Objects to format
Parameters:
  buffer - the StringBuffer
Parameters:
  field - a FieldPosition. the StringBuffer parameter buffer




format
final public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)
Formats the specified object into the specified StringBuffer using the pattern of this MessageFormat.
Parameters:
  object - the object to format, must be an array of Object
Parameters:
  buffer - the StringBuffer
Parameters:
  field - a FieldPosition which is ignored the StringBuffer parameter buffer
exception:
  ClassCastException - when object is not an array of Object



format
public static String format(String template, Object... objects)(Code)
Formats the Object arguments using the specified MessageFormat pattern.
Parameters:
  template - the pattern
Parameters:
  objects - the array of Objects to format the formatted result
exception:
  IllegalArgumentException - when the pattern cannot be parsed



formatToCharacterIterator
public AttributedCharacterIterator formatToCharacterIterator(Object object)(Code)
Formats the specified object using the rules of this MessageFormat and returns an AttributedCharacterIterator with the formatted message and attributes. The AttributedCharacterIterator returned also includes the attributes from the formats of this MessageFormat.
Parameters:
  object - the object to format an AttributedCharacterIterator with the formatted message andattributes
exception:
  IllegalArgumentException - when the arguments in the object array cannot be formattedby this Format



getFormats
public Format[] getFormats()(Code)
Answers the Formats of this MessageFormat. an array of Format



getFormatsByArgumentIndex
public Format[] getFormatsByArgumentIndex()(Code)
Answers the formats used for each argument index. If an argument is placed more than once in the pattern string, than returns the format of the last one. an array of formats, ordered by argument index



getLocale
public Locale getLocale()(Code)
Answers the Locale used when creating Formats. the Locale used to create Formats



hashCode
public int hashCode()(Code)
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. the receiver's hash
See Also:   MessageFormat.equals



parse
public Object[] parse(String string) throws ParseException(Code)
Parse the message arguments from the specified String using the rules of this MessageFormat.
Parameters:
  string - the String to parse the array of Object arguments resulting from the parse
exception:
  ParseException - when an error occurs during parsing



parse
public Object[] parse(String string, ParsePosition position)(Code)
Parse the message argument from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the array of Object arguments resulting from the parse, or nullif there is an error



parseObject
public Object parseObject(String string, ParsePosition position)(Code)
Parse the message argument from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the array of Object arguments resulting from the parse, or nullif there is an error



setFormat
public void setFormat(int offset, Format format)(Code)
Sets the specified Format used by this MessageFormat.
Parameters:
  offset - the format to change
Parameters:
  format - the Format



setFormatByArgumentIndex
public void setFormatByArgumentIndex(int argIndex, Format format)(Code)
Sets the format used for argument at index argIndexto format
Parameters:
  argIndex -
Parameters:
  format -



setFormats
public void setFormats(Format[] formats)(Code)
Sets the Formats used by this MessageFormat.
Parameters:
  formats - an array of Format



setFormatsByArgumentIndex
public void setFormatsByArgumentIndex(Format[] formats)(Code)
Sets the formats used for each argument The formats array elements should be in the order of the argument indices.
Parameters:
  formats -



setLocale
public void setLocale(Locale locale)(Code)
Sets the Locale to use when creating Formats.
Parameters:
  locale - the Locale



toPattern
public String toPattern()(Code)
Answers the pattern of this MessageFormat. the pattern



Methods inherited from java.text.Format
public Object clone()(Code)(Java Doc)
String convertPattern(String template, String fromChars, String toChars, boolean check)(Code)(Java Doc)
final public String format(Object object)(Code)(Java Doc)
abstract public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)(Java Doc)
public AttributedCharacterIterator formatToCharacterIterator(Object object)(Code)(Java Doc)
static Object getInternalField(String fieldName, Object target)(Code)(Java Doc)
public Object parseObject(String string) throws ParseException(Code)(Java Doc)
abstract public Object parseObject(String string, ParsePosition position)(Code)(Java Doc)
static boolean upTo(String string, ParsePosition position, StringBuffer buffer, char stop)(Code)(Java Doc)
static boolean upToWithQuotes(String string, ParsePosition position, StringBuffer buffer, char stop, char start)(Code)(Java Doc)

Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.