Java Doc for Utilities.java in  » Wiki-Engine » JAMWiki » org » jamwiki » utils » 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 » Wiki Engine » JAMWiki » org.jamwiki.utils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jamwiki.utils.Utilities

Utilities
public class Utilities (Code)
This class provides a variety of basic utility methods that are not dependent on any other classes within the org.jamwiki package structure.




Method Summary
public static  StringconvertEncoding(String text, String fromEncoding, String toEncoding)
     Convert a string value from one encoding to another.
Parameters:
  text - The string that is to be converted.
Parameters:
  fromEncoding - The encoding that the string is currently encoded in.
Parameters:
  toEncoding - The encoding that the string is to be encoded to.
public static  StringdecodeFromRequest(String url, boolean decodeUnderlines)
     Decode a value that has been retrieved from a servlet request.
public static  StringdecodeFromURL(String url, boolean decodeUnderlines)
     Decode a value that has been retrieved directly from a URL or file name.
public static  StringencodeForFilename(String name)
     Convert a topic name or other value into a value suitable for use as a file name.
public static  StringencodeForURL(String url)
     Encode a topic name for use in a URL.
public static  StringextractTrailingPunctuation(String text)
     Returns any trailing period, comma, semicolon, or colon characters from the given string.
public static  StringformatMessage(String key, Locale locale)
     Given a message key and locale return a locale-specific message.
Parameters:
  key - The message key that corresponds to the formatted messagebeing retrieved.
Parameters:
  locale - The locale for the message that is to be retrieved.
public static  StringformatMessage(String key, Locale locale, Object[] params)
     Given a message key, locale, and formatting parameters, return a locale-specific message.
Parameters:
  key - The message key that corresponds to the formatted messagebeing retrieved.
Parameters:
  locale - The locale for the message that is to be retrieved.
Parameters:
  params - An array of formatting parameters to use in the messagebeing returned.
public static  FilegetClassLoaderFile(String filename)
     Given a file name for a file that is located somewhere in the application classpath, return a File object representing the file.
Parameters:
  filename - The name of the file (relative to the classpath) that isto be retrieved.
public static  FilegetClassLoaderRoot()
     Attempt to get the class loader root directory.
public static  FilegetWebappRoot()
     Retrieve the webapp root.
public static  Mapintersect(Map map1, Map map2)
     Utility method for determining common elements in two Map objects.
public static  booleanisIpAddress(String ipAddress)
     Determine if the given string is a valid IPv4 or IPv6 address.
public static  StringreadFile(String filename)
     Utility method for reading a file from a classpath directory and returning its contents as a String.
Parameters:
  filename - The name of the file to be read, either as an absolute filepath or relative to the classpath.
public static  StringstripMarkup(String value)
     Strip all HTML tags from a string.



Method Detail
convertEncoding
public static String convertEncoding(String text, String fromEncoding, String toEncoding)(Code)
Convert a string value from one encoding to another.
Parameters:
  text - The string that is to be converted.
Parameters:
  fromEncoding - The encoding that the string is currently encoded in.
Parameters:
  toEncoding - The encoding that the string is to be encoded to. The encoded string.



decodeFromRequest
public static String decodeFromRequest(String url, boolean decodeUnderlines)(Code)
Decode a value that has been retrieved from a servlet request. This method will replace any underscores with spaces.
Parameters:
  url - The encoded value that is to be decoded.
Parameters:
  decodeUnderlines - Set to true if underlines shouldbe automatically converted to spaces. A decoded value.



decodeFromURL
public static String decodeFromURL(String url, boolean decodeUnderlines)(Code)
Decode a value that has been retrieved directly from a URL or file name. This method will URL decode the value and then replace any underscores with spaces. Note that this method SHOULD NOT be called for values retrieved using request.getParameter(), but only values taken directly from a URL.
Parameters:
  url - The encoded value that is to be decoded.
Parameters:
  decodeUnderlines - Set to true if underlines shouldbe automatically converted to spaces. A decoded value.



encodeForFilename
public static String encodeForFilename(String name)(Code)
Convert a topic name or other value into a value suitable for use as a file name. This method replaces spaces with underscores, and then URL encodes the value.
Parameters:
  name - The value that is to be encoded for use as a file name. The encoded value.



encodeForURL
public static String encodeForURL(String url)(Code)
Encode a topic name for use in a URL. This method will replace spaces with underscores and URL encode the value, but it will not URL encode colons.
Parameters:
  url - The topic name to be encoded for use in a URL. The encoded topic name value.



extractTrailingPunctuation
public static String extractTrailingPunctuation(String text)(Code)
Returns any trailing period, comma, semicolon, or colon characters from the given string. This method is useful when parsing raw HTML links, in which case trailing punctuation must be removed.
Parameters:
  text - The text from which trailing punctuation should be returned. Any trailing punctuation from the given text, or an empty stringotherwise.



formatMessage
public static String formatMessage(String key, Locale locale)(Code)
Given a message key and locale return a locale-specific message.
Parameters:
  key - The message key that corresponds to the formatted messagebeing retrieved.
Parameters:
  locale - The locale for the message that is to be retrieved. A formatted message string that is specific to the locale.



formatMessage
public static String formatMessage(String key, Locale locale, Object[] params)(Code)
Given a message key, locale, and formatting parameters, return a locale-specific message.
Parameters:
  key - The message key that corresponds to the formatted messagebeing retrieved.
Parameters:
  locale - The locale for the message that is to be retrieved.
Parameters:
  params - An array of formatting parameters to use in the messagebeing returned. A formatted message string that is specific to the locale.



getClassLoaderFile
public static File getClassLoaderFile(String filename) throws Exception(Code)
Given a file name for a file that is located somewhere in the application classpath, return a File object representing the file.
Parameters:
  filename - The name of the file (relative to the classpath) that isto be retrieved. A file object representing the requested filename
throws:
  Exception - Thrown if the classloader can not be found or ifthe file can not be found in the classpath.



getClassLoaderRoot
public static File getClassLoaderRoot() throws Exception(Code)
Attempt to get the class loader root directory. This method works by searching for a file that MUST exist in the class loader root and then returning its parent directory. Returns a file indicating the directory of the class loader.
throws:
  Exception - Thrown if the class loader can not be found.



getWebappRoot
public static File getWebappRoot() throws Exception(Code)
Retrieve the webapp root. The default webapp root directory.



intersect
public static Map intersect(Map map1, Map map2)(Code)
Utility method for determining common elements in two Map objects.



isIpAddress
public static boolean isIpAddress(String ipAddress)(Code)
Determine if the given string is a valid IPv4 or IPv6 address. This method uses pattern matching to see if the given string could be a valid IP address.
Parameters:
  ipAddress - A string that is to be examined to verify whether or notit could be a valid IP address. true if the string is a value that is a valid IP address,false otherwise.



readFile
public static String readFile(String filename) throws Exception(Code)
Utility method for reading a file from a classpath directory and returning its contents as a String.
Parameters:
  filename - The name of the file to be read, either as an absolute filepath or relative to the classpath. A string representation of the file contents.
throws:
  Exception - Thrown if the file cannot be found or if an I/O exceptionoccurs.



stripMarkup
public static String stripMarkup(String value)(Code)
Strip all HTML tags from a string. For example, "A bold word" will be returned as "A bold word". This method treats an tags that are between brackets as HTML, whether it is valid HTML or not.
Parameters:
  value - The value that will have HTML stripped from it. The value submitted to this method with all HTML tags removed from it.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) 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.