Package org.sikuli.basics
Class FileManager
java.lang.Object
org.sikuli.basics.FileManager
public class FileManager extends Object
INTERNAL USE: Support for accessing files and other ressources
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileManager.FileFilter -
Constructor Summary
Constructors Constructor Description FileManager() -
Method Summary
Modifier and Type Method Description static booleanbuildJar(String targetJar, String[] jars, String[] files, String[] prefixs, org.sikuli.basics.FileManager.JarFileFilter filter)static booleancheckJarContent(String jarPath, String jarContent)static StringconvertStreamToString(InputStream is)static FilecreateTempDir()static FilecreateTempDir(String path)static FilecreateTempFile(String suffix)static FilecreateTempFile(String suffix, String path)static booleandeleteFileOrFolder(File fPath)static booleandeleteFileOrFolder(File fPath, FileManager.FileFilter filter)static booleandeleteFileOrFolder(String fpPath)static booleandeleteFileOrFolder(String fpPath, FileManager.FileFilter filter)static voiddeleteNotUsedImages(String bundle, Set<String> usedImages)static voiddeleteTempDir(String path)static StringdownloadURL(String url, String localPath)download a file at the given url to a local folderstatic StringdownloadURL(String url, String localPath, JFrame progress)static StringdownloadURL(URL url, String localPath)download a file at the given url to a local folderstatic StringdownloadURLtoString(String src)static StringdownloadURLtoString(URL uSrc)static StringdownloadURLtoString(URL uSrc, boolean silent)static booleanexists(String path)static StringgetAddress(String arg)static StringgetAltFilename(String filename)static StringgetJarName(Class cname)static StringgetJarPath(Class cname)static StringgetName(String filename)static intgetPort(String p)static ProxygetProxy()static InetAddressgetProxyAddress(String arg)static intgetProxyPort(String p)static intgetRandomInt()static URLgetURLForContentFromURL(URL uRes, String fName)static booleanisBundle(String dir)static booleanisFilenameDotted(String name)static intisUrlUseabel(String sURL)static intisUrlUseabel(URL aURL)static StringmakeFileList(File path, String prefix)static URLmakeJarURL(File fJar)static StringmakeScriptjar(List<String> options)static URLmakeURL(String fName)static URLmakeURL(String fName, String type)static URLmakeURL(URL path, String fName)static voidmkdir(String path)static Stringnormalize(String path)static StringnormalizeAbsolute(String filename)static booleanopenURL(String url)open the given url in the standard browserstatic booleanpackJar(String folderName, String jarName, String prefix)static booleanpathEquals(String path1, String path2)static StringreadFileToString(File fPath)static voidresetFolder(File fPath)static FileresolveImagePath(File scriptFile)Returns the directory that contains the images used by the ScriptRunner.static StringsaveImage(BufferedImage img, String sImage, String bundlePath)static StringsaveTimedImage(BufferedImage img)static StringsaveTimedImage(BufferedImage img, String path)static StringsaveTimedImage(BufferedImage img, String path, String name)static StringsaveTmpImage(BufferedImage img)static StringsaveTmpImage(BufferedImage img, String path)static booleansetProxy(String pName, String pPort)static Stringslashify(String path, Boolean isDirectory)static FilesmartCopy(String src, String dest)Copy a file *src* to the path *dest* and check if the file name conflicts.static voidtraverseFolder(File fPath, FileManager.FileFilter filter)static booleanunpackJar(String jarName, String folderName, boolean del, boolean strip, org.sikuli.basics.FileManager.JarFileFilter filter)unpack a jar file to a folderstatic booleanunzip(File fZip, File fTarget)static booleanunzip(String inpZip, String target)static StringunzipSKL(String fpSkl)static booleanwriteStringToFile(String text, File fPath)static booleanwriteStringToFile(String text, String path)static booleanxcopy(File fSrc, File fDest)static booleanxcopy(File fSrc, File fDest, FileManager.FileFilter filter)static voidxcopy(String src, String dest)static voidxcopy(String src, String dest, FileManager.FileFilter filter)
-
Constructor Details
-
FileManager
public FileManager()
-
-
Method Details
-
isUrlUseabel
-
isUrlUseabel
-
getProxy
-
getProxyAddress
-
getProxyPort
-
setProxy
-
downloadURL
download a file at the given url to a local folder- Parameters:
url- a valid urllocalPath- the folder where the file should go (will be created if necessary)- Returns:
- the absolute path to the downloaded file or null on any error
-
downloadURL
download a file at the given url to a local folder- Parameters:
url- a string representing a valid urllocalPath- the folder where the file should go (will be created if necessary)- Returns:
- the absolute path to the downloaded file or null on any error
-
downloadURL
-
downloadURLtoString
-
downloadURLtoString
-
downloadURLtoString
-
openURL
open the given url in the standard browser- Parameters:
url- string representing a valid url- Returns:
- false on error, true otherwise
-
createTempDir
-
createTempDir
-
getRandomInt
public static int getRandomInt() -
deleteTempDir
-
deleteFileOrFolder
-
deleteFileOrFolder
-
deleteFileOrFolder
-
deleteFileOrFolder
-
resetFolder
-
traverseFolder
-
createTempFile
-
createTempFile
-
saveTmpImage
-
saveTmpImage
-
saveTimedImage
-
saveTimedImage
-
saveTimedImage
-
unzip
-
unzip
-
xcopy
-
xcopy
-
xcopy
- Throws:
IOException
-
xcopy
public static void xcopy(String src, String dest, FileManager.FileFilter filter) throws IOException- Throws:
IOException
-
makeFileList
-
smartCopy
Copy a file *src* to the path *dest* and check if the file name conflicts. If a file with the same name exists in that path, rename *src* to an alternative name.- Parameters:
src- source filedest- destination path- Returns:
- the destination file if ok, null otherwise
- Throws:
IOException- on failure
-
convertStreamToString
-
getAltFilename
-
exists
-
mkdir
-
getName
-
slashify
-
normalize
-
normalizeAbsolute
-
isFilenameDotted
-
resolveImagePath
Returns the directory that contains the images used by the ScriptRunner.- Parameters:
scriptFile- The file containing the script.- Returns:
- The directory containing the images.
-
makeURL
-
makeJarURL
-
makeURL
-
makeURL
-
getURLForContentFromURL
-
checkJarContent
-
getPort
-
getAddress
-
saveImage
-
deleteNotUsedImages
-
isBundle
-
getJarPath
-
getJarName
-
writeStringToFile
-
writeStringToFile
-
readFileToString
-
makeScriptjar
-
packJar
-
buildJar
-
unpackJar
public static boolean unpackJar(String jarName, String folderName, boolean del, boolean strip, org.sikuli.basics.FileManager.JarFileFilter filter)unpack a jar file to a folder- Parameters:
jarName- absolute path to jar filefolderName- absolute path to the target folderdel- true if the folder should be deleted before unpackstrip- true if the path should be strippedfilter- to select specific content- Returns:
- true if success, false otherwise
-
unzipSKL
-
pathEquals
-