Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.util.FileUtils Class Reference

List of all members.

Static Public Member Functions

static void writeFile (final InputStream input, final IFile file) throws CoreException
static void mkdirs (final IResource resource) throws CoreException
static void create (final IFolder folder) throws CoreException
static void delete (final IResource resource) throws CoreException
static void move (final IPath destination, final IResource source) throws CoreException
static Pair< Long, Long > getFileCountAndSize (Collection<?extends IResource > resources, boolean includeMembers, int flags)
static byte[] getLocalFileContent (IFile localFile)

Detailed Description

This class contains static utility methods for file handling.

Author:
orieger/chjacob

Member Function Documentation

static void de.fu_berlin.inf.dpp.util.FileUtils.create ( final IFolder  folder) throws CoreException [static]

Creates the given folder. All parent folder may be created on demand if necessary.

Parameters:
folderthe folder to create
Exceptions:
CoreException
static void de.fu_berlin.inf.dpp.util.FileUtils.delete ( final IResource  resource) throws CoreException [static]

Deletes the given resource and tries to store the existing resource to the Eclipse history space.

Parameters:
resourcethe resource to delete
Exceptions:
CoreException
static Pair<Long, Long> de.fu_berlin.inf.dpp.util.FileUtils.getFileCountAndSize ( Collection<?extends IResource resources,
boolean  includeMembers,
int  flags 
) [static]

Calculates the total file count and size for all resources.

Parameters:
resourcescollection containing the resources that file sizes and file count should be calculated
includeMemberstrue to include the members of resources that represents a IContainer container}
flagsadditional flags on how to process the members of containers
Returns:
a pair containing the Pair.p file size} and Pair.v file count} for the given resources
static byte [] de.fu_berlin.inf.dpp.util.FileUtils.getLocalFileContent ( IFile  localFile) [static]

Retrieves the content of a local file

Parameters:
localFile
Returns:
Byte array of the file contents. Is null if the file does not exist or is out of sync, the reference points to no file, or the conversion to a byte array failed.
static void de.fu_berlin.inf.dpp.util.FileUtils.mkdirs ( final IResource  resource) throws CoreException [static]

Makes sure that the parent directories of the given IResource resource} exist.

Exceptions:
CoreException
static void de.fu_berlin.inf.dpp.util.FileUtils.move ( final IPath  destination,
final IResource  source 
) throws CoreException [static]

Moves the given IResource to the place, that is pointed by the given IPath.

This method excepts both variables to be relative to the workspace.

Parameters:
destinationDestination of moving the given resource.
sourceResource, that is going to be moved
static void de.fu_berlin.inf.dpp.util.FileUtils.writeFile ( final InputStream  input,
final IFile  file 
) throws CoreException [static]

Writes the data of the given input stream to the given file.

Parameters:
inputthe input stream to write to the file
filethe file to create/overwrite
Exceptions:
CoreException
 All Classes Namespaces Files Functions Variables Enumerations