Java Doc for Utils.java in  » IDE-Netbeans » nbi » org » netbeans » installer » infra » build » ant » 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 » IDE Netbeans » nbi » org.netbeans.installer.infra.build.ant.utils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.installer.infra.build.ant.utils.Utils

Utils
final public class Utils (Code)
A collection of utility methods used throughout the custom tasks classes.
author:
   Kirill Sorokin

Inner Class :public static class Results

Field Summary
final public static  StringARG_PREFIX
     Prefix for JVM command-line arguments.
final public static  StringCLASSPATH_ARG
     Classpath command-line argument prefix.
final public static  StringCLASSPATH_VALUE_PROPERTY
     Name of the ant project's property which contains the classpath which should be used for running classes.
final public static  intDELTA_DELAY
     Delta deplay (in milliseconds) which to increase the delay between cheking the process state.
final public static  intINITIAL_DELAY
     Initial deplay (in milliseconds) between cheking the process state.
final public static  booleanIS_WINDOWS
     Name of the windows operationg system.
final public static  StringJARSIGNER_EXECUTABLE
    
final public static  StringJAR_EXTENSION
     Extension of jar files.
final public static  StringJAVA
     Path to the java executable on non-windows platforms.
final public static  StringJAVA_EXE
     Path to the java executable on windows platforms.
final public static  StringJAVA_EXECUTABLE
    
final public static  StringJAVA_HOME
     Name of the system property which contains the current java home.
final public static  StringJAVA_HOME_VALUE
     Value of the system property which contains the current java home.
final public static  StringLINE_SEPARATOR
    
final public static  StringLS_EXECUTABLE
    
final public static  intMAX_DELAY
     Max deplay (in milliseconds) which to wait between cheking the process state.
final public static  intMAX_EXECUTION_TIME
     Maximum allowed execution time for a process.
final public static  StringMAX_EXECUTION_TIME_PROPERTY
     Property for setting maximum allowed execution time for a process.
final public static  StringMAX_PERM_SIZE_ARG
     MacPermSize command-line argument prefix.
final public static  StringMD5
     MD5 digital digest algorithm code name.
final public static  StringNATIVE_UNZIP_EXECUTABLE
    
final public static  StringNEWLINE_REGEXP
     A regular expression which matches any line separator.
final public static  StringOS_NAME
     Name of the system property which contains the operating system name.
final public static  StringPACKER_EXECUTABLE
    
final public static  StringPERM_SIZE_ARG
     PermSize command-line argument prefix.
final public static  StringSLASH
     Forward slash.
final public static  StringSUN_MICR_RSA
     Marker file which indicated that the jar file is signed.
final public static  StringSUN_MICR_SF
     Marker file which indicated that the jar file is signed.
final public static  StringUBERKEY
     An artificial key name used in converting a string to ASCII.
final public static  StringUBERKEY_REGEXP
     An artificial regular expresion used in converting a string to ASCII.
final public static  StringUNPACKER_EXECUTABLE
    
final public static  StringUTF8
     Name of the UTF-8 encoding.
final public static  StringVERIFIER_CLASSNAME
     Classname of the class which should be called to verify the unpacked jar file.
final public static  StringWINDOWS
     Name of the windows operationg system.
final public static  StringXMX_ARG
     Maximum heap size command-line argument prefix.


Method Summary
public static  voidcopy(InputStream in, OutputStream out)
     Fully transfers the given input stream to the given output stream.
public static  voidcopy(File source, OutputStream target)
     Copies the contents of a file to the given output stream.
public static  voidcopy(File source, File target)
     Copies one file to another.
public static  voiddelete(File file)
     Deletes a file.
public static  StringgetMd5(File file)
     Calculates the MD5 checksum for the given file.
Parameters:
  file - File for which the checksum should be calculated.
public static  intgetPermissions(File file)
    
public static  booleanisEmpty(File file)
     Checks whether the given file is a directory.
Parameters:
  file - File to check for being a directory.
public static  booleanisJarFile(File file)
     Checks whether the given file is a jar archive.
Parameters:
  file - File to check for being a jar archive.
public static  booleanisSigned(File file)
     Checks whether the given file is a signed jar archive.
Parameters:
  file - File to check for being a signed jar archive.
public static  voidnativeUnzip(File file, File directory)
    
public static  booleanpack(File source, File target)
     Packs the given jar archive using the pack200 utility.
Parameters:
  source - Jar archive to pack.
Parameters:
  target - File which should become the packed jar archive.
public static  booleanpackInternally(File source, File target)
    
public static  Stringpost(String url, Map<String, Object> args)
     Sends an HTTP POST request to the given URL.
public static  CharSequenceread(InputStream in)
     Fully reads an input stream into a character sequence using the system's default encoding.
Parameters:
  in - Input sream to read.
public static  voidsetProject(Project project)
     Setter for the 'project' property.
public static  Resultssign(File file, String keystore, String alias, String password)
     Signs the given jar file using the data provided in the given keystore.
Parameters:
  file - Jar archive which will be signed.
Parameters:
  keystore - Path to the keystore file.
Parameters:
  alias - Keystore alias.
Parameters:
  password - Keystore password.
public static  longsize(File file)
     Measures the size of a file.
public static  StringtoAscii(String string)
     Converts the given string to its java-style ASCII equivalent, escaping non ASCII characters with their \\uXXXX sequences.
Parameters:
  string - String to escape.
public static  booleanunpack(File source, File target)
     Unpacks the given packed jar archive using the unpack200 utility.
Parameters:
  source - Packe jar archive to unpack.
Parameters:
  target - File to which the unpacked archive should be saved.
public static  booleanunpackInternally(File source, File target)
    
public static  voidunzip(File file, File directory)
     Unzips a zip archive to the specified directory.
public static  booleanverify(File file)
     Verifies that the jar archive is correct.
public static  booleanverifyJad(File file)
     Verifies that the if jar archive is placed next to jad, the jad file contains correct jar size
Parameters:
  file - Jar archive to check.
public static  voidwrite(File file, CharSequence chars)
     Writes the given character sequence to the given file.

Field Detail
ARG_PREFIX
final public static String ARG_PREFIX(Code)
Prefix for JVM command-line arguments.



CLASSPATH_ARG
final public static String CLASSPATH_ARG(Code)
Classpath command-line argument prefix.



CLASSPATH_VALUE_PROPERTY
final public static String CLASSPATH_VALUE_PROPERTY(Code)
Name of the ant project's property which contains the classpath which should be used for running classes.



DELTA_DELAY
final public static int DELTA_DELAY(Code)
Delta deplay (in milliseconds) which to increase the delay between cheking the process state.



INITIAL_DELAY
final public static int INITIAL_DELAY(Code)
Initial deplay (in milliseconds) between cheking the process state.



IS_WINDOWS
final public static boolean IS_WINDOWS(Code)
Name of the windows operationg system.



JARSIGNER_EXECUTABLE
final public static String JARSIGNER_EXECUTABLE(Code)



JAR_EXTENSION
final public static String JAR_EXTENSION(Code)
Extension of jar files.



JAVA
final public static String JAVA(Code)
Path to the java executable on non-windows platforms. Relative to the java home.



JAVA_EXE
final public static String JAVA_EXE(Code)
Path to the java executable on windows platforms. Relative to the java home.



JAVA_EXECUTABLE
final public static String JAVA_EXECUTABLE(Code)



JAVA_HOME
final public static String JAVA_HOME(Code)
Name of the system property which contains the current java home.



JAVA_HOME_VALUE
final public static String JAVA_HOME_VALUE(Code)
Value of the system property which contains the current java home.



LINE_SEPARATOR
final public static String LINE_SEPARATOR(Code)



LS_EXECUTABLE
final public static String LS_EXECUTABLE(Code)



MAX_DELAY
final public static int MAX_DELAY(Code)
Max deplay (in milliseconds) which to wait between cheking the process state.



MAX_EXECUTION_TIME
final public static int MAX_EXECUTION_TIME(Code)
Maximum allowed execution time for a process.



MAX_EXECUTION_TIME_PROPERTY
final public static String MAX_EXECUTION_TIME_PROPERTY(Code)
Property for setting maximum allowed execution time for a process.



MAX_PERM_SIZE_ARG
final public static String MAX_PERM_SIZE_ARG(Code)
MacPermSize command-line argument prefix.



MD5
final public static String MD5(Code)
MD5 digital digest algorithm code name.



NATIVE_UNZIP_EXECUTABLE
final public static String NATIVE_UNZIP_EXECUTABLE(Code)



NEWLINE_REGEXP
final public static String NEWLINE_REGEXP(Code)
A regular expression which matches any line separator.



OS_NAME
final public static String OS_NAME(Code)
Name of the system property which contains the operating system name.



PACKER_EXECUTABLE
final public static String PACKER_EXECUTABLE(Code)



PERM_SIZE_ARG
final public static String PERM_SIZE_ARG(Code)
PermSize command-line argument prefix.



SLASH
final public static String SLASH(Code)
Forward slash.



SUN_MICR_RSA
final public static String SUN_MICR_RSA(Code)
Marker file which indicated that the jar file is signed.



SUN_MICR_SF
final public static String SUN_MICR_SF(Code)
Marker file which indicated that the jar file is signed.



UBERKEY
final public static String UBERKEY(Code)
An artificial key name used in converting a string to ASCII.



UBERKEY_REGEXP
final public static String UBERKEY_REGEXP(Code)
An artificial regular expresion used in converting a string to ASCII.



UNPACKER_EXECUTABLE
final public static String UNPACKER_EXECUTABLE(Code)



UTF8
final public static String UTF8(Code)
Name of the UTF-8 encoding.



VERIFIER_CLASSNAME
final public static String VERIFIER_CLASSNAME(Code)
Classname of the class which should be called to verify the unpacked jar file.



WINDOWS
final public static String WINDOWS(Code)
Name of the windows operationg system.



XMX_ARG
final public static String XMX_ARG(Code)
Maximum heap size command-line argument prefix.





Method Detail
copy
public static void copy(InputStream in, OutputStream out) throws IOException(Code)
Fully transfers the given input stream to the given output stream.
Parameters:
  in - Input stream to read and transfer.
Parameters:
  out - Output stream to transfer data to.
throws:
  java.io.IOException - if an I/O error occurs.



copy
public static void copy(File source, OutputStream target) throws IOException(Code)
Copies the contents of a file to the given output stream.
Parameters:
  source - File whose contents should be copied.
Parameters:
  target - Output stream to which the file's contents should betransferred.
throws:
  java.io.IOException - if an I/O error occurs.



copy
public static void copy(File source, File target) throws IOException(Code)
Copies one file to another.
Parameters:
  source - File to be copied.
Parameters:
  target - File which should be come the copy of the source one.
throws:
  java.io.IOException - if an I/O error occurs.



delete
public static void delete(File file)(Code)
Deletes a file. If the file is a directory its contents are recursively deleted.
Parameters:
  file - File to be deleted.



getMd5
public static String getMd5(File file) throws IOException(Code)
Calculates the MD5 checksum for the given file.
Parameters:
  file - File for which the checksum should be calculated. The MD5 checksum of the file.
throws:
  java.io.IOException - if an I/O error occurs.



getPermissions
public static int getPermissions(File file)(Code)



isEmpty
public static boolean isEmpty(File file)(Code)
Checks whether the given file is a directory.
Parameters:
  file - File to check for being a directory. true if the file is a directory, falseotherwise.



isJarFile
public static boolean isJarFile(File file)(Code)
Checks whether the given file is a jar archive.
Parameters:
  file - File to check for being a jar archive. true if the file is a jar archive, falseotherwise.



isSigned
public static boolean isSigned(File file) throws IOException(Code)
Checks whether the given file is a signed jar archive.
Parameters:
  file - File to check for being a signed jar archive. true if the file is a signedjar archive,false otherwise.
throws:
  java.io.IOException - if an I/O error occurs.



nativeUnzip
public static void nativeUnzip(File file, File directory) throws IOException(Code)



pack
public static boolean pack(File source, File target) throws IOException(Code)
Packs the given jar archive using the pack200 utility.
Parameters:
  source - Jar archive to pack.
Parameters:
  target - File which should become the packed jar archive. The target file, i.e. the packed jar archive.
throws:
  java.io.IOException - if an I/O error occurs.



packInternally
public static boolean packInternally(File source, File target) throws IOException(Code)



post
public static String post(String url, Map<String, Object> args) throws IOException(Code)
Sends an HTTP POST request to the given URL. The supplied parameters will be passed as part of the request body according to http://www.faqs.org/rfcs/rfc1945.html .
Parameters:
  url - URL to shich the POST request should be sent.
Parameters:
  args - Request parameters. The first line of the server response, e.g. "HTTP/1.x 200 OK".
throws:
  java.io.IOException - if an I/O error occurs.



read
public static CharSequence read(InputStream in) throws IOException(Code)
Fully reads an input stream into a character sequence using the system's default encoding.
Parameters:
  in - Input sream to read. The read data as a character sequence.
throws:
  java.io.IOException - if an I/O error occurs.



setProject
public static void setProject(Project project)(Code)
Setter for the 'project' property.
Parameters:
  project - New value for the 'project' property.



sign
public static Results sign(File file, String keystore, String alias, String password) throws IOException(Code)
Signs the given jar file using the data provided in the given keystore.
Parameters:
  file - Jar archive which will be signed.
Parameters:
  keystore - Path to the keystore file.
Parameters:
  alias - Keystore alias.
Parameters:
  password - Keystore password. The results of executing the jarsigner utility.
throws:
  java.io.IOException - if an I/O error occurs.



size
public static long size(File file)(Code)
Measures the size of a file. If the file is a directory, its size would be equal to the sum of sizes of all its files and subdirectories.
Parameters:
  file - File whose size should be measured. The size of file.



toAscii
public static String toAscii(String string)(Code)
Converts the given string to its java-style ASCII equivalent, escaping non ASCII characters with their \\uXXXX sequences.
Parameters:
  string - String to escape. The escaped string.



unpack
public static boolean unpack(File source, File target) throws IOException(Code)
Unpacks the given packed jar archive using the unpack200 utility.
Parameters:
  source - Packe jar archive to unpack.
Parameters:
  target - File to which the unpacked archive should be saved. The target file, i.e. the unpacked jar archive.
throws:
  java.io.IOException - if an I/O errors occurs.



unpackInternally
public static boolean unpackInternally(File source, File target) throws IOException(Code)



unzip
public static void unzip(File file, File directory) throws IOException(Code)
Unzips a zip archive to the specified directory.
Parameters:
  file - Zip archive to extract.
Parameters:
  directory - Directory which will be the target for the extraction.
throws:
  java.io.IOException - if an I/O error occurs.



verify
public static boolean verify(File file) throws IOException(Code)
Verifies that the jar archive is correct. This method tries to access all jar archive entries and to load all the classes.
Parameters:
  file - Jar archive to check. true is the archive is correct, falseotherwise.
throws:
  java.io.IOException - if an I/O error occurs.



verifyJad
public static boolean verifyJad(File file) throws IOException(Code)
Verifies that the if jar archive is placed next to jad, the jad file contains correct jar size
Parameters:
  file - Jar archive to check. true is the archive is correct, falseotherwise.
throws:
  java.io.IOException - if an I/O error occurs.



write
public static void write(File file, CharSequence chars) throws IOException(Code)
Writes the given character sequence to the given file.
Parameters:
  file - File to which the character sequence should be written.
Parameters:
  chars - Character sequence which should be written to the file.
throws:
  java.io.IOException - if an I/O error occurs.



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.