Java Doc for BasicUtilities.java in  » Database-Client » iSQL-Viewer » org » isqlviewer » 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 » Database Client » iSQL Viewer » org.isqlviewer.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.isqlviewer.util.BasicUtilities

BasicUtilities
public class BasicUtilities (Code)
TODO Add BasicUtilities Overview JavaDoc.


author:
   Mark A. Kobold <mkobold at isqlviewer dot com>
version:
   1.0





Method Summary
public static  voidbackupFile(File baseFile, File backupFile)
     Backup a specific file to another file using compression.
public static  voidcopyReader(Reader in, Writer out)
     Utility method from moving an inputstream to an outputstream.
public static  voidcopySelectedCellsToClipBoard(JTable table)
     Creates a tab delimited text for selected cells of the given JTable.
public static  voidcopyStream(InputStream in, OutputStream out)
     Utility method from moving an inputstream to an outputstream.
public static  StringcreateSafeFilename(String fileName)
     Creates a generally safe file name.

This method will hopefully prevent silly errors that can occur by attempting to create a file with illegal characters.

public static  XMLReadercreateXMLReader(boolean namespaceAware, boolean validating)
     Helper method for creating an XML reader for parsing XML documents.


Parameters:
  namespaceAware - sets namespace aware property in the XMLReader.
Parameters:
  validating - set the validating property with the XMLReader.

public static  booleandeleteDirectory(File directory)
     Deletes a directory including all childern.

One small problem that is easily overlooked in Java is that you cannot delete a non-empty directory.

This method will recursivlely scan the directory for other directories and files and proceed to delete them.

public static  intgetCommandMask()
    
public static  booleanisThreadInterrupted()
     Helper method for checking if the current thread is interrupted without resetting the interrupted state.
public static  voidrestoreSystemErr()
     Utilitiy method to restore System.err to the default FileDescriptor.
public static  voidrestoreSystemOut()
     Utilitiy method to restore System.out to the default FileDescriptor.
public static  voidsortCollection(Collection<Object> collection)
     Utility method for sorting collections.
public static  voidsortCollection(Collection<Object> collection, Comparator<Object> sorter)
     Utility method for sorting collections.

This will sort a collection based on the comparator given.

public static  voidwrapThrowable(Throwable sourceError, Throwable wrappedError)
     Wraps an exception including the stack trace elements.



Method Detail
backupFile
public static void backupFile(File baseFile, File backupFile) throws IOException(Code)
Backup a specific file to another file using compression.

This will copy the contents of baseFile to backupFile using a GZIPOutputStream such that it will compressed.
Parameters:
  baseFile - the file to create a backup of.
Parameters:
  backupFile - the new destination file for the backup.




copyReader
public static void copyReader(Reader in, Writer out) throws IOException(Code)
Utility method from moving an inputstream to an outputstream.

Pretty basic stuff here every byte read from in is immediately written to out.
Parameters:
  in - InputStream to read from.
Parameters:
  out - OutputStream to write to.
throws:
  IOException - if error occurs while write




copySelectedCellsToClipBoard
public static void copySelectedCellsToClipBoard(JTable table)(Code)
Creates a tab delimited text for selected cells of the given JTable.


Parameters:
  table - to copy selection from.




copyStream
public static void copyStream(InputStream in, OutputStream out) throws IOException(Code)
Utility method from moving an inputstream to an outputstream.

Pretty basic stuff here every byte read from in is immediately written to out.
Parameters:
  in - InputStream to read from.
Parameters:
  out - OutputStream to write to.
throws:
  IOException - if error occurs while write




createSafeFilename
public static String createSafeFilename(String fileName)(Code)
Creates a generally safe file name.

This method will hopefully prevent silly errors that can occur by attempting to create a file with illegal characters. This method more or less takes all the ASCII symbols and converts them to underscores.

This method more or less is a culmination of what i know to be invalid and or annoying characters to have in a file name on the systems i know.

For *NIX users in paticular so extra precautions are made so that the names of these files will be easier to deal with in shell scripts such that there aren't many characters that will make them difficult when dealing within a given shell, and shouldn't have to resorting to alot of escape sequences.
Parameters:
  fqFilename - original filename. String an updated version that should be safe for most systems.




createXMLReader
public static XMLReader createXMLReader(boolean namespaceAware, boolean validating) throws ParserConfigurationException(Code)
Helper method for creating an XML reader for parsing XML documents.


Parameters:
  namespaceAware - sets namespace aware property in the XMLReader.
Parameters:
  validating - set the validating property with the XMLReader. instance of XMLReader for parsing XML.
throws:
  ParserConfigurationException - if the XMLReader fails to instantiate properly.
See Also:   SAXParserFactory.setNamespaceAware(boolean)
See Also:   SAXParserFactory.setValidating(boolean)




deleteDirectory
public static boolean deleteDirectory(File directory)(Code)
Deletes a directory including all childern.

One small problem that is easily overlooked in Java is that you cannot delete a non-empty directory.

This method will recursivlely scan the directory for other directories and files and proceed to delete them. This method should be executed with caution as it provides no safeguards if a directory is accidently deleted.
Parameters:
  directory - true if the directory was successfully deleted.




getCommandMask
public static int getCommandMask()(Code)



isThreadInterrupted
public static boolean isThreadInterrupted()(Code)
Helper method for checking if the current thread is interrupted without resetting the interrupted state.

true if the calling thread is interrupted.




restoreSystemErr
public static void restoreSystemErr()(Code)
Utilitiy method to restore System.err to the default FileDescriptor.




restoreSystemOut
public static void restoreSystemOut()(Code)
Utilitiy method to restore System.out to the default FileDescriptor.




sortCollection
public static void sortCollection(Collection<Object> collection)(Code)
Utility method for sorting collections.

This will sort a collection based on the natural ordering of the objects contained in the collection.
Parameters:
  collection - to be sorted.
See Also:   BasicUtilities.sortCollection(Collection,Comparator)




sortCollection
public static void sortCollection(Collection<Object> collection, Comparator<Object> sorter)(Code)
Utility method for sorting collections.

This will sort a collection based on the comparator given. If the given comparator is null then naturall based on the objects will be used.
Parameters:
  collection - to be sorted.
Parameters:
  sorter - object that can determine the order of the object in the given collection.
See Also:   BasicUtilities.sortCollection(Collection)




wrapThrowable
public static void wrapThrowable(Throwable sourceError, Throwable wrappedError)(Code)
Wraps an exception including the stack trace elements.


Parameters:
  sourceError - that needs to be wrapped.
Parameters:
  wrappedError - new error that is a facade of the sourceError.




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.