Java Doc for MiscUtilities.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » 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 » Swing Library » jEdit » org.gjt.sp.jedit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.gjt.sp.jedit.MiscUtilities

MiscUtilities
public class MiscUtilities (Code)
Path name manipulation, string manipulation, and more.

The most frequently used members of this class are:

Some path name methods:

String comparison:

A MiscUtilities.compareStrings(String,String,boolean) method that unlike String.compareTo(), correctly recognizes and handles embedded numbers.

This class also defines several inner classes for use with the sorting features of the Java collections API:

For example, you might call:

Arrays.sort(myListOfStrings, new MiscUtilities.StringICaseCompare());
author:
   Slava Pestov
author:
   John Gellene (API documentation)
version:
   $Id: MiscUtilities.java 9835 2007-06-22 10:51:33Z Vampire0 $


Inner Class :public interface Compare extends Comparator
Inner Class :public static class StringCompare implements Compare
Inner Class :public static class StringICaseCompare implements Comparator<Object>
Inner Class :public static class MenuItemCompare implements Compare

Field Summary
final public static  DecimalFormatKB_FORMAT
    
final public static  DecimalFormatMB_FORMAT
    
final public static  StringUTF_8_Y
     This encoding is not supported by Java, yet it is useful.
final static  PatternvarPattern
    
final static  PatternvarPattern2
    
final static  StringvarPatternString
    
final static  StringvarPatternString2
    


Method Summary
public static  Readerautodetect(InputStream in, Buffer buffer)
     Tries to detect if the stream is gzipped, and if it has an encoding specified with an XML PI.
Parameters:
  in - the input stream reader that must be autodetected
Parameters:
  buffer - a buffer.
public static  StringbuildToVersion(String build)
     Converts an internal version number (build) into a `human-readable' form.
public static  StringcanonPath(String path)
     the canonical form of the specified path name.
public static  StringcharsToEntities(String str)
     Converts <, >, & in the string to their HTML entity equivalents.
public static  StringcharsToEscapes(String str)
     Escapes newlines, tabs, backslashes, and quotes in the specified string.
public static  StringcharsToEscapes(String str, String toEscape)
     Escapes the specified characters in the specified string.
public static  StringclassToFile(String name)
     Converts a class name to a file name.
public static  voidcloseQuietly(InputStream in)
     Method that will close an InputStream ignoring it if it is null and ignoring exceptions.
public static  voidcloseQuietly(OutputStream out)
     Method that will close an OutputStream ignoring it if it is null and ignoring exceptions.
public static  intcompareStrings(String str1, String str2, boolean ignoreCase)
     Compares two strings.

Unlike String.compareTo(), this method correctly recognizes and handles embedded numbers.

public static  intcompareVersions(String v1, String v2)
    
public static  StringconcatPath(String parent, String path)
     Like MiscUtilities.constructPath , except path will be appended to parent even if it is absolute.
public static  StringconstructPath(String parent, String path)
     Constructs an absolute path name from a directory and another path name.
public static  StringconstructPath(String parent, String path1, String path2)
     Constructs an absolute path name from three path components.
public static  booleancopyStream(int bufferSize, ProgressObserver progress, InputStream in, OutputStream out, boolean canStop)
     Copy an input stream to an output stream.
public static  booleancopyStream(ProgressObserver progress, InputStream in, OutputStream out, boolean canStop)
     Copy an input stream to an output stream with a buffer of 4096 bytes.
public static  StringcreateWhiteSpace(int len, int tabSize)
    
public static  StringcreateWhiteSpace(int len, int tabSize, int start)
    
public static  StringescapesToChars(String str)
     Converts "\n" and "\t" escapes in the specified string to newlines and tabs.
public static  StringexpandVariables(String arg)
     Accepts a string from the user which may contain variables of various syntaxes.
public static  StringfileToClass(String name)
     Converts a file name to a class name.
public static  InputSourcefindEntity(String systemId, String test, Class where)
     Tries to find the given systemId in the context of the given class.
public static  StringformatFileSize(long length)
     Formats the given file size into a nice string (123 Bytes, 10.6 kB, 1.2 MB).
public static  String[]getEncodings()
     Returns a list of supported character encodings.
public static  String[]getEncodings(boolean getSelected)
     Returns a list of supported character encodings.
public static  StringgetFileExtension(String path)
     Returns the extension of the specified filename, or an empty string if there is none.
public static  StringgetFileName(String path)
     Returns the last component of the specified path.
public static  StringgetFileNameNoExtension(String path)
     Returns the last component of the specified path name without the trailing extension (if there is one).
public static  StringgetFileParent(String path)
    
public static  StringgetFileProtocol(String url)
    
public static  intgetFirstSeparatorIndex(String path)
     Return the first index of either / or the OS-specific file separator.
public static  intgetLastSeparatorIndex(String path)
     Return the last index of either / or the OS-specific file separator.
public static  intgetLeadingWhiteSpace(String str)
     Returns the number of leading white space characters in the specified string.
public static  intgetLeadingWhiteSpaceWidth(String str, int tabSize)
     Returns the width of the leading white space in the specified string.
public static  StringgetLongestPrefix(List str, boolean ignoreCase)
     Returns the longest common prefix in the given set of strings.
public static  StringgetLongestPrefix(String[] str, boolean ignoreCase)
     Returns the longest common prefix in the given set of strings.
public static  StringgetLongestPrefix(Object[] str, boolean ignoreCase)
     Returns the longest common prefix in the given set of strings.
public static  intgetOffsetOfVirtualColumn(Segment seg, int tabSize, int column, int[] totalVirtualWidth)
     Returns the array offset of a virtual column number (taking tabs into account) in the segment.
Parameters:
  seg - The segment
Parameters:
  tabSize - The tab size
Parameters:
  column - The virtual column number
Parameters:
  totalVirtualWidth - If this array is non-null, the totalvirtual width will be stored in its first location if this methodreturns -1.
public static  StringgetParentOfPath(String path)
     Returns the parent of the specified path.
public static  StringgetProtocolOfURL(String url)
     Returns the protocol specified by a URL.
public static  intgetTrailingWhiteSpace(String str)
     Returns the number of trailing whitespace characters in the specified string.
public static  intgetVirtualWidth(Segment seg, int tabSize)
     Returns the virtual column number (taking tabs into account) of the specified offset in the segment.
public static  StringglobToRE(String glob)
     Converts a Unix-style glob to a regular expression.

? becomes ., * becomes .*, {aa,bb} becomes (aa|bb).

public static  booleanisAbsolutePath(String path)
     Returns if the specified path name is an absolute path or URL.
public static  booleanisBackup(String filename)
     Check if the filename is a backup file.
public static  booleanisBinary(Reader reader)
     Check if a Reader is binary.
public static  booleanisBinary(InputStream in)
     Check if an InputStream is binary. First this tries encoding auto detection.
public static  booleanisToolsJarAvailable()
     If on JDK 1.2 or higher, make sure that tools.jar is available. This method should be called by plugins requiring the classes in this library.

tools.jar is searched for in the following places:

  1. the classpath that was used when jEdit was started,
  2. jEdit's jars folder in the user's home,
  3. jEdit's system jars folder,
  4. java.home/lib/.
public static  booleanisURL(String str)
     Checks if the specified string is a URL.
public static  booleanmoveFile(File source, File dest)
     Moves the source file to the destination. If the destination cannot be created or is a read-only file, the method returns false.
public static  booleanobjectsEqual(Object o1, Object o2)
     Returns if two strings are equal.
public static  intparsePermissions(String s)
     Parse a Unix-style permission string (rwxrwxrwx).
public static  booleanparseXML(InputStream in, DefaultHandler handler)
     Convenience method for parsing an XML file.
public static  booleanpathsEqual(String p1, String p2)
    
public static  voidquicksort(Object[] obj, Comparator compare)
     Sorts the specified array.
public static  voidquicksort(Vector vector, Comparator compare)
     Sorts the specified vector.
public static  voidquicksort(List list, Comparator compare)
     Sorts the specified list.
public static  voidquicksort(Object[] obj, Compare compare)
     Sorts the specified array.
public static  voidquicksort(Vector vector, Compare compare)
     Sorts the specified vector.
public static  StringresolveSymlinks(String path)
     Resolves any symbolic links in the path name specified using File.getCanonicalPath().
public static  voidsaveBackup(File file, int backups, String backupPrefix, String backupSuffix, String backupDirectory)
     Saves a backup (optionally numbered) of a file.
Parameters:
  file - A local file
Parameters:
  backups - The number of backups.
public static  voidsaveBackup(File file, int backups, String backupPrefix, String backupSuffix, String backupDirectory, int backupTimeDistance)
     Saves a backup (optionally numbered) of a file.
Parameters:
  file - A local file
Parameters:
  backups - The number of backups.
public static  booleanstringsEqual(String s1, String s2)
    
public static  StringthrowableToString(Throwable t)
     Returns a string containing the stack trace of the given throwable.

Field Detail
KB_FORMAT
final public static DecimalFormat KB_FORMAT(Code)



MB_FORMAT
final public static DecimalFormat MB_FORMAT(Code)



UTF_8_Y
final public static String UTF_8_Y(Code)
This encoding is not supported by Java, yet it is useful. A UTF-8 file that begins with 0xEFBBBF.



varPattern
final static Pattern varPattern(Code)



varPattern2
final static Pattern varPattern2(Code)



varPatternString
final static String varPatternString(Code)



varPatternString2
final static String varPatternString2(Code)





Method Detail
autodetect
public static Reader autodetect(InputStream in, Buffer buffer) throws IOException(Code)
Tries to detect if the stream is gzipped, and if it has an encoding specified with an XML PI.
Parameters:
  in - the input stream reader that must be autodetected
Parameters:
  buffer - a buffer. It can be null if you only want to autodetect the encoding of a file a Reader using the detected encoding
throws:
  IOException - io exception during read
since:
   jEdit 4.3pre5



buildToVersion
public static String buildToVersion(String build)(Code)
Converts an internal version number (build) into a `human-readable' form.
Parameters:
  build - The build



canonPath
public static String canonPath(String path)(Code)
the canonical form of the specified path name. Currentlyonly expands a leading ~. For local path namesonly.
Parameters:
  path - The path name
since:
   jEdit 4.0pre2



charsToEntities
public static String charsToEntities(String str)(Code)
Converts <, >, & in the string to their HTML entity equivalents.
Parameters:
  str - The string
since:
   jEdit 4.2pre1org.gjt.sp.util.XMLUtilities.charsToEntities(Stringboolean)



charsToEscapes
public static String charsToEscapes(String str)(Code)
Escapes newlines, tabs, backslashes, and quotes in the specified string.
Parameters:
  str - The string
since:
   jEdit 2.3pre1



charsToEscapes
public static String charsToEscapes(String str, String toEscape)(Code)
Escapes the specified characters in the specified string.
Parameters:
  str - The string
Parameters:
  toEscape - Any characters that require escaping
since:
   jEdit 4.1pre3



classToFile
public static String classToFile(String name)(Code)
Converts a class name to a file name. All periods are replaced with slashes and the '.class' extension is added.
Parameters:
  name - The class name



closeQuietly
public static void closeQuietly(InputStream in)(Code)
Method that will close an InputStream ignoring it if it is null and ignoring exceptions.
Parameters:
  in - the InputStream to close.
since:
   jEdit 4.3pre3IOUtilities.closeQuietly(java.io.InputStream)



closeQuietly
public static void closeQuietly(OutputStream out)(Code)
Method that will close an OutputStream ignoring it if it is null and ignoring exceptions.
Parameters:
  out - the OutputStream to close.
since:
   jEdit 4.3pre3IOUtilities.closeQuietly(java.io.OutputStream)



compareStrings
public static int compareStrings(String str1, String str2, boolean ignoreCase)(Code)
Compares two strings.

Unlike String.compareTo(), this method correctly recognizes and handles embedded numbers. For example, it places "My file 2" before "My file 10".


Parameters:
  str1 - The first string
Parameters:
  str2 - The second string
Parameters:
  ignoreCase - If true, case will be ignored negative If str1 < str2, 0 if both are the same,positive if str1 > str2
since:
   jEdit 4.0pre1org.gjt.sp.util.StandardUtilities.compareStrings(StringStringboolean)




compareVersions
public static int compareVersions(String v1, String v2)(Code)



concatPath
public static String concatPath(String parent, String path)(Code)
Like MiscUtilities.constructPath , except path will be appended to parent even if it is absolute. For local path names only..
Parameters:
  path -
Parameters:
  parent -



constructPath
public static String constructPath(String parent, String path)(Code)
Constructs an absolute path name from a directory and another path name. This method is VFS-aware.
Parameters:
  parent - The directory
Parameters:
  path - The path name



constructPath
public static String constructPath(String parent, String path1, String path2)(Code)
Constructs an absolute path name from three path components. This method is VFS-aware.
Parameters:
  parent - The parent directory
Parameters:
  path1 - The first path
Parameters:
  path2 - The second path



copyStream
public static boolean copyStream(int bufferSize, ProgressObserver progress, InputStream in, OutputStream out, boolean canStop) throws IOException(Code)
Copy an input stream to an output stream.
Parameters:
  bufferSize - the size of the buffer
Parameters:
  progress - the progress observer it could be null
Parameters:
  in - the input stream
Parameters:
  out - the output stream
Parameters:
  canStop - if true, the copy can be stopped by interrupting the thread true if the copy was done, false if it was interrupted
throws:
  IOException - IOException If an I/O error occurs
since:
   jEdit 4.3pre3IOUtilities.copyStream(intorg.gjt.sp.util.ProgressObserverjava.io.InputStreamjava.io.OutputStreamboolean)



copyStream
public static boolean copyStream(ProgressObserver progress, InputStream in, OutputStream out, boolean canStop) throws IOException(Code)
Copy an input stream to an output stream with a buffer of 4096 bytes.
Parameters:
  progress - the progress observer it could be null
Parameters:
  in - the input stream
Parameters:
  out - the output stream
Parameters:
  canStop - if true, the copy can be stopped by interrupting the thread true if the copy was done, false if it was interrupted
throws:
  IOException - IOException If an I/O error occurs
since:
   jEdit 4.3pre3IOUtilities.copyStream(org.gjt.sp.util.ProgressObserverjava.io.InputStreamjava.io.OutputStreamboolean)



createWhiteSpace
public static String createWhiteSpace(int len, int tabSize)(Code)
Creates a string of white space with the specified length.

To get a whitespace string tuned to the current buffer's settings, call this method as follows:

myWhitespace = MiscUtilities.createWhiteSpace(myLength,
 (buffer.getBooleanProperty("noTabs") ? 0
 : buffer.getTabSize()));

Parameters:
  len - The length
Parameters:
  tabSize - The tab size, or 0 if tabs are not to be usedorg.gjt.sp.util.StandardUtilities.createWhiteSpace(intint)



createWhiteSpace
public static String createWhiteSpace(int len, int tabSize, int start)(Code)
Creates a string of white space with the specified length.

To get a whitespace string tuned to the current buffer's settings, call this method as follows:

myWhitespace = MiscUtilities.createWhiteSpace(myLength,
 (buffer.getBooleanProperty("noTabs") ? 0
 : buffer.getTabSize()));

Parameters:
  len - The length
Parameters:
  tabSize - The tab size, or 0 if tabs are not to be used
Parameters:
  start - The start offset, for tab alignment
since:
   jEdit 4.2pre1org.gjt.sp.util.StandardUtilities.createWhiteSpace(intintint)



escapesToChars
public static String escapesToChars(String str)(Code)
Converts "\n" and "\t" escapes in the specified string to newlines and tabs.
Parameters:
  str - The string
since:
   jEdit 2.3pre1



expandVariables
public static String expandVariables(String arg)(Code)
Accepts a string from the user which may contain variables of various syntaxes. The goal is to support the following: $varname ${varname} And expand each of these by looking at the system environment variables for possible expansions. a string which is either the unchanged input string, or one with expanded variables.
since:
   4.3pre7
author:
   ezust



fileToClass
public static String fileToClass(String name)(Code)
Converts a file name to a class name. All slash characters are replaced with periods and the trailing '.class' is removed.
Parameters:
  name - The file name



findEntity
public static InputSource findEntity(String systemId, String test, Class where)(Code)
Tries to find the given systemId in the context of the given class. XMLUtilities.findEntity(StringStringClass)



formatFileSize
public static String formatFileSize(long length)(Code)
Formats the given file size into a nice string (123 Bytes, 10.6 kB, 1.2 MB).
Parameters:
  length - The size
since:
   jEdit 4.2pre1



getEncodings
public static String[] getEncodings()(Code)
Returns a list of supported character encodings.
since:
   jEdit 4.2pre5



getEncodings
public static String[] getEncodings(boolean getSelected)(Code)
Returns a list of supported character encodings.
since:
   jEdit 4.3pre5
Parameters:
  getSelected - Whether to return just the selected encodings or all.



getFileExtension
public static String getFileExtension(String path)(Code)
Returns the extension of the specified filename, or an empty string if there is none.
Parameters:
  path - The path



getFileName
public static String getFileName(String path)(Code)
Returns the last component of the specified path. This method is VFS-aware.
Parameters:
  path - The path name



getFileNameNoExtension
public static String getFileNameNoExtension(String path)(Code)
Returns the last component of the specified path name without the trailing extension (if there is one).
Parameters:
  path - The path name
since:
   jEdit 4.0pre8



getFileParent
public static String getFileParent(String path)(Code)



getFileProtocol
public static String getFileProtocol(String url)(Code)



getFirstSeparatorIndex
public static int getFirstSeparatorIndex(String path)(Code)
Return the first index of either / or the OS-specific file separator.
Parameters:
  path - The path
since:
   jEdit 4.3pre3



getLastSeparatorIndex
public static int getLastSeparatorIndex(String path)(Code)
Return the last index of either / or the OS-specific file separator.
Parameters:
  path - The path
since:
   jEdit 4.3pre3



getLeadingWhiteSpace
public static int getLeadingWhiteSpace(String str)(Code)
Returns the number of leading white space characters in the specified string.
Parameters:
  str - The stringorg.gjt.sp.util.StandardUtilities.getLeadingWhiteSpace(String)



getLeadingWhiteSpaceWidth
public static int getLeadingWhiteSpaceWidth(String str, int tabSize)(Code)
Returns the width of the leading white space in the specified string.
Parameters:
  str - The string
Parameters:
  tabSize - The tab sizeorg.gjt.sp.util.StandardUtilities.getLeadingWhiteSpace(String)



getLongestPrefix
public static String getLongestPrefix(List str, boolean ignoreCase)(Code)
Returns the longest common prefix in the given set of strings.
Parameters:
  str - The strings
Parameters:
  ignoreCase - If true, case insensitive
since:
   jEdit 4.2pre2



getLongestPrefix
public static String getLongestPrefix(String[] str, boolean ignoreCase)(Code)
Returns the longest common prefix in the given set of strings.
Parameters:
  str - The strings
Parameters:
  ignoreCase - If true, case insensitive
since:
   jEdit 4.2pre2



getLongestPrefix
public static String getLongestPrefix(Object[] str, boolean ignoreCase)(Code)
Returns the longest common prefix in the given set of strings.
Parameters:
  str - The strings (calls toString() on each object)
Parameters:
  ignoreCase - If true, case insensitive
since:
   jEdit 4.2pre6



getOffsetOfVirtualColumn
public static int getOffsetOfVirtualColumn(Segment seg, int tabSize, int column, int[] totalVirtualWidth)(Code)
Returns the array offset of a virtual column number (taking tabs into account) in the segment.
Parameters:
  seg - The segment
Parameters:
  tabSize - The tab size
Parameters:
  column - The virtual column number
Parameters:
  totalVirtualWidth - If this array is non-null, the totalvirtual width will be stored in its first location if this methodreturns -1. -1 if the column is out of bounds
since:
   jEdit 4.1pre1org.gjt.sp.util.StandardUtilities.getVirtualWidth(javax.swing.text.Segmentint)



getParentOfPath
public static String getParentOfPath(String path)(Code)
Returns the parent of the specified path. This method is VFS-aware.
Parameters:
  path - The path name
since:
   jEdit 2.6pre5



getProtocolOfURL
public static String getProtocolOfURL(String url)(Code)
Returns the protocol specified by a URL.
Parameters:
  url - The URL
since:
   jEdit 2.6pre5



getTrailingWhiteSpace
public static int getTrailingWhiteSpace(String str)(Code)
Returns the number of trailing whitespace characters in the specified string.
Parameters:
  str - The string
since:
   jEdit 2.5pre5org.gjt.sp.util.StandardUtilities.getTrailingWhiteSpace(String)



getVirtualWidth
public static int getVirtualWidth(Segment seg, int tabSize)(Code)
Returns the virtual column number (taking tabs into account) of the specified offset in the segment.
Parameters:
  seg - The segment
Parameters:
  tabSize - The tab size
since:
   jEdit 4.1pre1org.gjt.sp.util.StandardUtilities.getVirtualWidth(javax.swing.text.Segmentint)



globToRE
public static String globToRE(String glob)(Code)
Converts a Unix-style glob to a regular expression.

? becomes ., * becomes .*, {aa,bb} becomes (aa|bb).
Parameters:
  glob - The glob patternorg.gjt.sp.util.StandardUtilities.globToRE(String)




isAbsolutePath
public static boolean isAbsolutePath(String path)(Code)
Returns if the specified path name is an absolute path or URL.
since:
   jEdit 4.1pre11



isBackup
public static boolean isBackup(String filename)(Code)
Check if the filename is a backup file.
Parameters:
  filename - the filename to check true if this is a backup file.
since:
   jEdit 4.3pre5



isBinary
public static boolean isBinary(Reader reader) throws IOException(Code)
Check if a Reader is binary.



isBinary
public static boolean isBinary(InputStream in) throws IOException(Code)
Check if an InputStream is binary. First this tries encoding auto detection. If an encoding is detected, the stream should be a text stream. Otherwise, this will check the first characters 100 (jEdit property vfs.binaryCheck.length) in the system default encoding. If more than 1 (jEdit property vfs.binaryCheck.count) NUL(\u0000) was found, the stream is declared binary. This is not 100% because sometimes the autodetection could fail. This method will not close the stream. You have to do it yourself
Parameters:
  in - the stream true if the stream was detected as binary
throws:
  IOException - IOException If an I/O error occurs
since:
   jEdit 4.3pre10



isToolsJarAvailable
public static boolean isToolsJarAvailable()(Code)
If on JDK 1.2 or higher, make sure that tools.jar is available. This method should be called by plugins requiring the classes in this library.

tools.jar is searched for in the following places:

  1. the classpath that was used when jEdit was started,
  2. jEdit's jars folder in the user's home,
  3. jEdit's system jars folder,
  4. java.home/lib/. In this case, tools.jar is added to jEdit's list of known jars using jEdit.addPluginJAR(), so that it gets loaded through JARClassLoader.

On older JDK's this method does not perform any checks, and returns true (even though there is no tools.jar). false if and only if on JDK 1.2 and tools.jarcould not be found. In this case it prints some warnings on Log,too, about the places where it was searched for.
since:
   jEdit 3.2.2




isURL
public static boolean isURL(String str)(Code)
Checks if the specified string is a URL.
Parameters:
  str - The string to check True if the string is a URL, false otherwise



moveFile
public static boolean moveFile(File source, File dest)(Code)
Moves the source file to the destination. If the destination cannot be created or is a read-only file, the method returns false. Otherwise, the contents of the source are copied to the destination, the source is deleted, and true is returned.
Parameters:
  source - The source file to move.
Parameters:
  dest - The destination where to move the file. true on success, false otherwise.
since:
   jEdit 4.3pre1org.gjt.sp.util.IOUtilities.moveFile(java.io.Filejava.io.File)



objectsEqual
public static boolean objectsEqual(Object o1, Object o2)(Code)
Returns if two strings are equal. This correctly handles null pointers, as opposed to calling o1.equals(o2).
since:
   jEdit 4.2pre1StandardUtilities.objectsEqual(ObjectObject)



parsePermissions
public static int parsePermissions(String s)(Code)
Parse a Unix-style permission string (rwxrwxrwx).
Parameters:
  s - The string (must be 9 characters long).
since:
   jEdit 4.1pre8



parseXML
public static boolean parseXML(InputStream in, DefaultHandler handler) throws IOException(Code)
Convenience method for parsing an XML file. Whether any error occured during parsing.
since:
   jEdit 4.3pre5XMLUtilities.parseXML(InputStreamDefaultHandler)



pathsEqual
public static boolean pathsEqual(String p1, String p2)(Code)

Parameters:
  p1 - A path name
Parameters:
  p2 - A path name True if both paths are equal, ignoring trailing slashes, aswell as case insensitivity on Windows.
since:
   jEdit 4.3pre2



quicksort
public static void quicksort(Object[] obj, Comparator compare)(Code)
Sorts the specified array. Equivalent to calling Arrays.sort().
Parameters:
  obj - The array
Parameters:
  compare - Compares the objects
since:
   jEdit 4.0pre4



quicksort
public static void quicksort(Vector vector, Comparator compare)(Code)
Sorts the specified vector.
Parameters:
  vector - The vector
Parameters:
  compare - Compares the objects
since:
   jEdit 4.0pre4



quicksort
public static void quicksort(List list, Comparator compare)(Code)
Sorts the specified list.
Parameters:
  list - The list
Parameters:
  compare - Compares the objects
since:
   jEdit 4.0pre4



quicksort
public static void quicksort(Object[] obj, Compare compare)(Code)
Sorts the specified array. Equivalent to calling Arrays.sort().
Parameters:
  obj - The array
Parameters:
  compare - Compares the objects



quicksort
public static void quicksort(Vector vector, Compare compare)(Code)
Sorts the specified vector.
Parameters:
  vector - The vector
Parameters:
  compare - Compares the objects



resolveSymlinks
public static String resolveSymlinks(String path)(Code)
Resolves any symbolic links in the path name specified using File.getCanonicalPath(). For local path names only.
since:
   jEdit 4.2pre1



saveBackup
public static void saveBackup(File file, int backups, String backupPrefix, String backupSuffix, String backupDirectory)(Code)
Saves a backup (optionally numbered) of a file.
Parameters:
  file - A local file
Parameters:
  backups - The number of backups. Must be >= 1. If > 1, backupfiles will be numbered.
Parameters:
  backupPrefix - The backup file name prefix
Parameters:
  backupSuffix - The backup file name suffix
Parameters:
  backupDirectory - The directory where to save backups; if null,they will be saved in the same directory as the file itself.
since:
   jEdit 4.0pre1



saveBackup
public static void saveBackup(File file, int backups, String backupPrefix, String backupSuffix, String backupDirectory, int backupTimeDistance)(Code)
Saves a backup (optionally numbered) of a file.
Parameters:
  file - A local file
Parameters:
  backups - The number of backups. Must be >= 1. If > 1, backupfiles will be numbered.
Parameters:
  backupPrefix - The backup file name prefix
Parameters:
  backupSuffix - The backup file name suffix
Parameters:
  backupDirectory - The directory where to save backups; if null,they will be saved in the same directory as the file itself.
Parameters:
  backupTimeDistance - The minimum time in minutes when a backupversion 1 shall be moved into version 2; if 0, backups are alwaysmoved.
since:
   jEdit 4.2pre5



stringsEqual
public static boolean stringsEqual(String s1, String s2)(Code)



throwableToString
public static String throwableToString(Throwable t)(Code)
Returns a string containing the stack trace of the given throwable.
since:
   jEdit 4.2pre6



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.