Java Doc for Util.java in  » Ajax » GWT » com » google » gwt » dev » util » 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 » Ajax » GWT » com.google.gwt.dev.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.google.gwt.dev.util.Util

Util
final public class Util (Code)
A smattering of useful methods. Methods in this class are candidates for being moved to com.google.gwt.util.tools.Utility if they would be generally useful to tool writers, and don't involve TreeLogger.


Field Summary
public static  StringDEFAULT_ENCODING
    
final public static  File[]EMPTY_ARRAY_FILE
    
final public static  String[]EMPTY_ARRAY_STRING
    
public static  char[]HEX_CHARS
    


Method Summary
public static  voidaddAll(Collection<T> c, T[] a)
    
public static  byte[]append(byte[] xs, byte x)
    
public static  T[]append(T[] xs, T x)
    
public static  T[]append(T[] appendToThis, T[] these)
    
public static  StringcomputeStrongName(byte[] content)
     Computes the MD5 hash for the specified byte array.
public static  booleancopy(TreeLogger logger, File in, File out)
    
public static  voidcopy(TreeLogger logger, InputStream is, File out)
    
public static  voidcopy(TreeLogger logger, InputStream is, OutputStream os)
    
public static  booleancopy(TreeLogger logger, URL in, File out)
    
public static  ReadercreateReader(TreeLogger logger, URL url)
    
public static  voiddeleteFilesInDirectory(File dir)
    
public static  voiddeleteFilesStartingWith(File dir, String prefix)
     Deletes all files have the same base name as the specified file.
public static  StringescapeXml(String unescaped)
     Escapes '&', '<', '>', '"', and '\'' to their XML entity equivalents.
public static  StringfindFileName(String location)
     Converts a URL "jar:file:aaa.jar!bbb" to the filename "aaa.jar".
public static  URLfindSourceInClassPath(ClassLoader cl, String sourceTypeName)
    
public static  StringgetClassName(Class cls)
    
Parameters:
  cls - A class whose name you want.
public static  StringgetClassName(String className)
    
Parameters:
  className - A fully-qualified class name whose name you want.
public static  StringgetFileFromInstallPath(String relativePath)
     Gets the contents of a file.
public static  voidhex4(char c, StringBuffer sb)
     A 4-digit hex result.
public static  voidinvokeInaccessableMethod(Class targetClass, String methodName, Class[] argumentTypes, TypeOracle target, Object[] arguments)
     This method invokes an inaccessible method in another class.
public static  booleanisCompilationUnitOnDisk(String loc)
    
public static  booleanisValidJavaIdent(String token)
    
public static  voidlogMissingTypeErrorWithHints(TreeLogger logger, String missingType)
    
public static  FilemakeRelativeFile(File from, File to)
     Attempts to make a path relative to a particular directory.
public static  StringmakeRelativePath(File from, File to)
    
public static  StringmakeRelativePath(File from, String to)
    
public static  StringmaybeDumpSource(TreeLogger logger, String location, char[] source, String optionalTypeName)
     Give the developer a chance to see the in-memory source that failed.
public static  byte[]readFileAsBytes(File file)
    
public static  char[]readFileAsChars(File file)
    
public static  StringreadFileAsString(File file)
    
public static  StringreadNextLine(BufferedReader br)
     Reads the next non-empty line.
public static  byte[]readURLAsBytes(URL url)
    
public static  char[]readURLAsChars(URL url)
    
public static  voidrecursiveDelete(File file, boolean childrenOnly)
     Deletes a file or recursively deletes a directory.
public static  FileremoveExtension(File file)
    
public static  T[]removeNulls(T[] a)
    
public static  Stringslashify(String path)
    
Parameters:
  path - The path to slashify.
public static  T[]toArray(Class<? super T> componentType, Collection<? extends T> coll)
     Creates an array from a collection of the specified component type and size.
public static  T[]toArrayReversed(Class<? super T> componentType, Collection<? extends T> coll)
     Like Util.toArray(Class,Collection) , but the option of having the array reversed.
public static  StringtoHexString(byte[] bytes)
     Returns a string representation of the byte array as a series of hexadecimal characters.
public static  String[]toStringArray(Collection<String> coll)
     Creates a string array from the contents of a collection.
public static  URLtoURL(File f)
    
public static  URLtoURL(URL jarUrl, JarEntry jarEntry)
    
public static  URLtoURL(URL jarUrl, String path)
    
public static  StringtoXml(Document doc)
    
public static  byte[]toXmlUtf8(Document doc)
    
public static  FiletryCombine(File parentMaybeIgnored, File childMaybeAbsolute)
    
public static  FiletryCombine(File parentMaybeIgnored, String childMaybeAbsolute)
    
public static  FiletryMakeCanonical(File file)
     Attempts to find the canonical form of a file path.
public static  voidwriteBytesToFile(TreeLogger logger, File where, byte[] what)
    
public static  voidwriteBytesToFile(TreeLogger logger, File where, byte[][] what)
     Gathering write.
public static  voidwriteCharsAsFile(TreeLogger logger, File file, char[] chars)
    
public static  booleanwriteStringAsFile(File file, String string)
    

Field Detail
DEFAULT_ENCODING
public static String DEFAULT_ENCODING(Code)



EMPTY_ARRAY_FILE
final public static File[] EMPTY_ARRAY_FILE(Code)



EMPTY_ARRAY_STRING
final public static String[] EMPTY_ARRAY_STRING(Code)



HEX_CHARS
public static char[] HEX_CHARS(Code)





Method Detail
addAll
public static void addAll(Collection<T> c, T[] a)(Code)



append
public static byte[] append(byte[] xs, byte x)(Code)



append
public static T[] append(T[] xs, T x)(Code)



append
public static T[] append(T[] appendToThis, T[] these)(Code)



computeStrongName
public static String computeStrongName(byte[] content)(Code)
Computes the MD5 hash for the specified byte array. a big fat string encoding of the MD5 for the content, suitablyformatted for use as a file name



copy
public static boolean copy(TreeLogger logger, File in, File out) throws UnableToCompleteException(Code)



copy
public static void copy(TreeLogger logger, InputStream is, File out) throws UnableToCompleteException(Code)



copy
public static void copy(TreeLogger logger, InputStream is, OutputStream os) throws UnableToCompleteException(Code)



copy
public static boolean copy(TreeLogger logger, URL in, File out) throws UnableToCompleteException(Code)



createReader
public static Reader createReader(TreeLogger logger, URL url) throws UnableToCompleteException(Code)



deleteFilesInDirectory
public static void deleteFilesInDirectory(File dir)(Code)



deleteFilesStartingWith
public static void deleteFilesStartingWith(File dir, String prefix)(Code)
Deletes all files have the same base name as the specified file.



escapeXml
public static String escapeXml(String unescaped)(Code)
Escapes '&', '<', '>', '"', and '\'' to their XML entity equivalents.



findFileName
public static String findFileName(String location)(Code)
Converts a URL "jar:file:aaa.jar!bbb" to the filename "aaa.jar". This also does URLDecoding if needed.
Parameters:
  location - the URL pointing at a jar location the path to the jar file



findSourceInClassPath
public static URL findSourceInClassPath(ClassLoader cl, String sourceTypeName)(Code)



getClassName
public static String getClassName(Class cls)(Code)

Parameters:
  cls - A class whose name you want. The base name for the specified class.



getClassName
public static String getClassName(String className)(Code)

Parameters:
  className - A fully-qualified class name whose name you want. The base name for the specified class.



getFileFromInstallPath
public static String getFileFromInstallPath(String relativePath)(Code)
Gets the contents of a file.
Parameters:
  relativePath - relative path within the install directory the contents of the file, or null if an error occurred



hex4
public static void hex4(char c, StringBuffer sb)(Code)
A 4-digit hex result.



invokeInaccessableMethod
public static void invokeInaccessableMethod(Class targetClass, String methodName, Class[] argumentTypes, TypeOracle target, Object[] arguments)(Code)
This method invokes an inaccessible method in another class.
Parameters:
  targetClass - the class owning the method
Parameters:
  methodName - the name of the method
Parameters:
  argumentTypes - the types of the parameters to the method call
Parameters:
  target - the receiver of the method call
Parameters:
  arguments - the parameters to the method call



isCompilationUnitOnDisk
public static boolean isCompilationUnitOnDisk(String loc)(Code)



isValidJavaIdent
public static boolean isValidJavaIdent(String token)(Code)



logMissingTypeErrorWithHints
public static void logMissingTypeErrorWithHints(TreeLogger logger, String missingType)(Code)



makeRelativeFile
public static File makeRelativeFile(File from, File to)(Code)
Attempts to make a path relative to a particular directory.
Parameters:
  from - the directory from which 'to' should be relative
Parameters:
  to - an absolute path which will be returned so that it is relative to'from' the relative path, if possible; null otherwise



makeRelativePath
public static String makeRelativePath(File from, File to)(Code)



makeRelativePath
public static String makeRelativePath(File from, String to)(Code)



maybeDumpSource
public static String maybeDumpSource(TreeLogger logger, String location, char[] source, String optionalTypeName)(Code)
Give the developer a chance to see the in-memory source that failed.



readFileAsBytes
public static byte[] readFileAsBytes(File file)(Code)



readFileAsChars
public static char[] readFileAsChars(File file)(Code)



readFileAsString
public static String readFileAsString(File file)(Code)



readNextLine
public static String readNextLine(BufferedReader br)(Code)
Reads the next non-empty line. a non-empty string that has been trimmed or null if the reader isexhausted



readURLAsBytes
public static byte[] readURLAsBytes(URL url)(Code)
null if the file could not be read



readURLAsChars
public static char[] readURLAsChars(URL url)(Code)
null if the file could not be read



recursiveDelete
public static void recursiveDelete(File file, boolean childrenOnly)(Code)
Deletes a file or recursively deletes a directory.
Parameters:
  file - the file to delete, or if this is a directory, the directorythat serves as the root of a recursive deletion
Parameters:
  childrenOnly - if true, only the children of adirectory are recursively deleted but the specified directoryitself is spared; if false, the specifieddirectory is also deleted; ignored if file is not adirectory



removeExtension
public static File removeExtension(File file)(Code)



removeNulls
public static T[] removeNulls(T[] a)(Code)



slashify
public static String slashify(String path)(Code)

Parameters:
  path - The path to slashify. The path with any directory separators replaced with '/'.



toArray
public static T[] toArray(Class<? super T> componentType, Collection<? extends T> coll)(Code)
Creates an array from a collection of the specified component type and size. You can definitely downcast the result to T[] if T is the specified component type. Class is used to allow creation of generic types, such as Map.Entry since we can only pass in Map.Entry.class.



toArrayReversed
public static T[] toArrayReversed(Class<? super T> componentType, Collection<? extends T> coll)(Code)
Like Util.toArray(Class,Collection) , but the option of having the array reversed.



toHexString
public static String toHexString(byte[] bytes)(Code)
Returns a string representation of the byte array as a series of hexadecimal characters.
Parameters:
  bytes - byte array to convert a string representation of the byte array as a series ofhexadecimal characters



toStringArray
public static String[] toStringArray(Collection<String> coll)(Code)
Creates a string array from the contents of a collection.



toURL
public static URL toURL(File f)(Code)



toURL
public static URL toURL(URL jarUrl, JarEntry jarEntry)(Code)



toURL
public static URL toURL(URL jarUrl, String path)(Code)



toXml
public static String toXml(Document doc)(Code)



toXmlUtf8
public static byte[] toXmlUtf8(Document doc)(Code)



tryCombine
public static File tryCombine(File parentMaybeIgnored, File childMaybeAbsolute)(Code)



tryCombine
public static File tryCombine(File parentMaybeIgnored, String childMaybeAbsolute)(Code)



tryMakeCanonical
public static File tryMakeCanonical(File file)(Code)
Attempts to find the canonical form of a file path. the canonical version of the file path, if it could be computed;otherwise, the original file is returned unmodified



writeBytesToFile
public static void writeBytesToFile(TreeLogger logger, File where, byte[] what) throws UnableToCompleteException(Code)



writeBytesToFile
public static void writeBytesToFile(TreeLogger logger, File where, byte[][] what) throws UnableToCompleteException(Code)
Gathering write.



writeCharsAsFile
public static void writeCharsAsFile(TreeLogger logger, File file, char[] chars) throws UnableToCompleteException(Code)



writeStringAsFile
public static boolean writeStringAsFile(File file, String string)(Code)



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.