Package jetbrains.mps.util
Class FileUtil
- java.lang.Object
 - 
- jetbrains.mps.util.FileUtil
 
 
- 
public class FileUtil extends Object
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileUtil.PathResolutionException 
- 
Field Summary
Fields Modifier and Type Field Description static CharsetDEFAULT_CHARSETstatic StringDEFAULT_CHARSET_NAME 
- 
Constructor Summary
Constructors Constructor Description FileUtil() 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancanWrite(File f)static booleanclear(File dir)static voidcloseFileSafe(Closeable c)static voidcopyDir(File what, File to)static voidcopyFile(File f, File to)static voidcopyFileChecked(File f, File to)static FilecreateTmpDir()static FilecreateTmpDir(String prefix)static FilecreateTmpFile()static FilecreateTmpFile(String prefix)static booleandelete(File root)static booleandeleteWithAllEmptyDirs(IFile file)deletes the file and all its parents above which happen to be empty after this file's removalstatic StringgetAbsolutePath(String path)static StringgetCanonicalPath(String path)static StringgetExtension(String name)static StringgetNameWithoutExtension(String name)static longgetNewestFileTime(File dir)static longgetNewestFileTime(File dir, boolean recursive)static StringgetRelativePath(String targetPath, String basePath, String pathSeparator)static FilegetTempDir()static StringgetUnixPath(String path)Deprecated.static booleanisAbsolute(String path)static booleanisAncestor(String ancestorPath, String path)static booleanisIgnoredDir(String name)static booleanisSubPath(String base, String sub)static Stringnormalize(String path)static Stringread(File file)static Stringread(File file, String charset)static Stringread(Reader reader)static StringreadLine(Reader reader, int lineNo)static StringresolveParentDirs(String path)Deprecated.static StringstripLastSlashes(String path)static Stringunquote(String urlString)static voidwrite(File file, byte[] content)static voidwriteFile(File file, String content)static voidzip(File dir, File to)static voidzip(Map<String,File> entries, File to) 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_CHARSET_NAME
public static final String DEFAULT_CHARSET_NAME
- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_CHARSET
public static final Charset DEFAULT_CHARSET
 
 - 
 
- 
Method Detail
- 
getTempDir
public static File getTempDir()
 
- 
copyFileChecked
public static void copyFileChecked(File f, File to) throws IOException
- Throws:
 IOException
 
- 
normalize
@NotNull public static String normalize(@NotNull String path)
- Returns:
 - unix-style path without last slashes with some version of normalization
 
 
- 
resolveParentDirs
@Deprecated public static String resolveParentDirs(@NotNull String path)
Deprecated. 
- 
delete
public static boolean delete(File root)
 
- 
deleteWithAllEmptyDirs
public static boolean deleteWithAllEmptyDirs(@NotNull IFile file)
deletes the file and all its parents above which happen to be empty after this file's removal- Returns:
 - true iff the file has been removed
 
 
- 
clear
public static boolean clear(File dir)
 
- 
getNewestFileTime
public static long getNewestFileTime(File dir)
 
- 
getNewestFileTime
public static long getNewestFileTime(File dir, boolean recursive)
 
- 
writeFile
public static void writeFile(File file, String content) throws IOException
- Throws:
 IOException
 
- 
write
public static void write(File file, byte[] content)
 
- 
isIgnoredDir
public static boolean isIgnoredDir(String name)
 
- 
getUnixPath
@Deprecated @NotNull public static String getUnixPath(@NotNull String path)
Deprecated. 
- 
getRelativePath
public static String getRelativePath(@NotNull String targetPath, @NotNull String basePath, @NotNull String pathSeparator)
- Throws:
 FileUtil.PathResolutionException- if the paths do not intersect
 
- 
closeFileSafe
public static void closeFileSafe(Closeable c)
 
- 
canWrite
public static boolean canWrite(File f)
 
- 
getNameWithoutExtension
@NotNull public static String getNameWithoutExtension(@NotNull String name)
 
- 
stripLastSlashes
@Contract("null -> null;!null->!null") @Nullable public static String stripLastSlashes(@Nullable String path)
 
 - 
 
 -