public final class FileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
copy(File source,
File target)
Copy a file.
|
static void |
copy(org.eclipse.emf.common.util.URI source,
org.eclipse.emf.common.util.URI target)
Copy a file.
|
static void |
createDir(String name)
Create a directory.
|
static void |
createFile(String name,
String contents)
Create a file.
|
static void |
delete(File target)
Delete a file.
|
static void |
delete(org.eclipse.emf.common.util.URI target)
Delete a file.
|
static void |
deleteContents(File dir)
Delete the contents of a directory (without deleting the directory
itself).
|
static String |
getContents(File file)
Get contents of a Java file as string.
|
static String |
getContents(org.eclipse.core.resources.IFile file)
Get contents of an Eclipse resource file as string.
|
static String |
getContents(InputStream in)
Read contents of an input stream to a string.
|
static String |
getExtension(File file)
Get the extension of a file.
|
static org.eclipse.core.resources.IFile |
getFile(String fullPath)
Get a file from the workspace.
|
static String |
getNameWithoutExtension(File file)
Get the name of a file without its extension.
|
static void |
move(File source,
File target)
Move a file.
|
static void |
move(org.eclipse.emf.common.util.URI source,
org.eclipse.emf.common.util.URI target)
Move a file.
|
static File |
replaceFileExtension(File file,
String newExtension)
Replace the extension of a file with another one.
|
static org.eclipse.core.resources.IFile |
resolveFile(org.eclipse.core.resources.IContainer container,
String name)
Resolve a file name with respect to a container which may be a project or
a folder.
|
public static String getContents(org.eclipse.core.resources.IFile file)
public static String getContents(InputStream in) throws IOException
IOException
public static String getContents(File file) throws IOException
IOException
public static org.eclipse.core.resources.IFile resolveFile(org.eclipse.core.resources.IContainer container, String name)
public static void move(org.eclipse.emf.common.util.URI source, org.eclipse.emf.common.util.URI target)
public static void delete(File target)
public static void delete(org.eclipse.emf.common.util.URI target)
public static void copy(File source, File target) throws IOException
IOException
public static void copy(org.eclipse.emf.common.util.URI source, org.eclipse.emf.common.util.URI target) throws IOException
IOException
public static void createFile(String name, String contents) throws IOException
IOException
public static void createDir(String name)
public static String getExtension(File file)
public static String getNameWithoutExtension(File file)
public static File replaceFileExtension(File file, String newExtension)
public static void deleteContents(File dir)
public static org.eclipse.core.resources.IFile getFile(String fullPath)
Copyright © 2020. All rights reserved.