Documentation of 'org.python.indexer.Util' Java class
Util
org.python.indexer

Class Util



  • public class Util
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      Util() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String arrayToSortedStringSet(java.util.Collection<java.lang.String> strings) 
      static java.lang.String arrayToString(java.util.Collection<java.lang.String> strings) 
      static java.lang.String canonicalize(java.lang.String path)
      Return absolute path for path.
      static java.lang.String gensym(java.lang.String base) 
      static byte[] getBytesFromFile(java.io.File file) 
      static java.lang.String getMD5(byte[] fileContents) 
      static java.lang.String getMD5(java.io.File path) 
      static java.lang.String getQnameParent(java.lang.String qname)
      Returns the parent qname of qname -- everything up to the last dot (exclusive), or if there are no dots, the empty string.
      static java.lang.String getSystemTempDir() 
      static java.io.File joinPath(java.io.File dir, java.lang.String file) 
      static java.io.File joinPath(java.lang.String dir, java.lang.String file) 
      static java.lang.String moduleNameFor(java.lang.String path)
      Given an absolute path to a file (not a directory), returns the module name for the file.
      static java.lang.String moduleQname(java.lang.String file)
      Determines the fully-qualified module name for the specified file.
      static java.lang.String readFile(java.io.File path) 
      static java.lang.String readFile(java.lang.String filename) 
      static void writeFile(java.lang.String path, java.lang.String contents) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • gensym

        public static java.lang.String gensym(java.lang.String base)
      • getSystemTempDir

        public static java.lang.String getSystemTempDir()
      • getQnameParent

        public static java.lang.String getQnameParent(java.lang.String qname)
        Returns the parent qname of qname -- everything up to the last dot (exclusive), or if there are no dots, the empty string.
      • moduleQname

        public static java.lang.String moduleQname(java.lang.String file)
        Determines the fully-qualified module name for the specified file. A module's qname is a function of the module's absolute path and the sys path; it does not depend on how the module name may have been specified in import statements. The module qname is the relative path of the module under the load path, with slashes converted to dots.
        Parameters:
        file - absolute canonical path to a file (__init__.py for dirs)
        Returns:
        null if file is not somewhere under the load path
      • arrayToString

        public static java.lang.String arrayToString(java.util.Collection<java.lang.String> strings)
      • arrayToSortedStringSet

        public static java.lang.String arrayToSortedStringSet(java.util.Collection<java.lang.String> strings)
      • moduleNameFor

        public static java.lang.String moduleNameFor(java.lang.String path)
        Given an absolute path to a file (not a directory), returns the module name for the file. If the file is an __init__.py, returns the last component of the file's parent directory, else returns the filename without path or extension.
      • joinPath

        public static java.io.File joinPath(java.io.File dir,
                                            java.lang.String file)
      • joinPath

        public static java.io.File joinPath(java.lang.String dir,
                                            java.lang.String file)
      • writeFile

        public static void writeFile(java.lang.String path,
                                     java.lang.String contents)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readFile

        public static java.lang.String readFile(java.lang.String filename)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readFile

        public static java.lang.String readFile(java.io.File path)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getBytesFromFile

        public static byte[] getBytesFromFile(java.io.File file)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getMD5

        public static java.lang.String getMD5(java.io.File path)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getMD5

        public static java.lang.String getMD5(byte[] fileContents)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • canonicalize

        public static java.lang.String canonicalize(java.lang.String path)
        Return absolute path for path. Make sure path ends with SEP if it's a directory. Does _not_ resolve symlinks, since the caller may need to play symlink tricks to produce the desired paths for loaded modules.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.