com.android.utils
Class FileUtils

java.lang.Object
  extended by com.android.utils.FileUtils

public final class FileUtils
extends java.lang.Object


Field Summary
static com.google.common.base.Function<java.io.File,java.lang.String> GET_NAME
           
 
Method Summary
static void copy(java.io.File from, java.io.File toDir)
           
static void delete(java.io.File file)
           
static void deleteFolder(java.io.File folder)
           
static void deleteIfExists(java.io.File file)
           
static void emptyFolder(java.io.File folder)
           
static com.google.common.collect.FluentIterable<java.io.File> getAllFiles(java.io.File dir)
           
static java.lang.String getNamesAsCommaSeparatedList(java.lang.Iterable<java.io.File> files)
           
static java.io.File join(java.io.File dir, java.lang.Iterable<java.lang.String> paths)
          Joins a list of path segments to a given File object.
static java.io.File join(java.io.File dir, java.lang.String... paths)
          Joins a list of path segments to a given File object.
static java.lang.String join(java.lang.Iterable<java.lang.String> paths)
          Joins a set of segment into a string, separating each segments with a host-specific path separator.
static java.lang.String join(java.lang.String... paths)
          Joins a set of segment into a string, separating each segments with a host-specific path separator.
static java.lang.String loadFileWithUnixLineSeparators(java.io.File file)
          Loads a text file forcing the line separator to be of Unix style '\n' rather than being Windows style '\r\n'.
static void mkdirs(java.io.File folder)
           
static java.lang.String relativePath(java.io.File file, java.io.File dir)
           
static java.lang.String relativePossiblyNonExistingPath(java.io.File file, java.io.File dir)
           
static void renameTo(java.io.File file, java.io.File to)
           
static java.lang.String sha1(java.io.File file)
           
static java.lang.String toSystemDependentPath(java.lang.String path)
           
static com.google.common.base.Predicate<java.io.File> withExtension(java.lang.String extension)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_NAME

public static final com.google.common.base.Function<java.io.File,java.lang.String> GET_NAME
Method Detail

withExtension

@NonNull
public static com.google.common.base.Predicate<java.io.File> withExtension(@NonNull
                                                                                   java.lang.String extension)

deleteFolder

public static void deleteFolder(@NonNull
                                java.io.File folder)
                         throws java.io.IOException
Throws:
java.io.IOException

emptyFolder

public static void emptyFolder(@NonNull
                               java.io.File folder)
                        throws java.io.IOException
Throws:
java.io.IOException

copy

public static void copy(@NonNull
                        java.io.File from,
                        @NonNull
                        java.io.File toDir)
                 throws java.io.IOException
Throws:
java.io.IOException

mkdirs

public static void mkdirs(@NonNull
                          java.io.File folder)

delete

public static void delete(@NonNull
                          java.io.File file)
                   throws java.io.IOException
Throws:
java.io.IOException

deleteIfExists

public static void deleteIfExists(@NonNull
                                  java.io.File file)
                           throws java.io.IOException
Throws:
java.io.IOException

renameTo

public static void renameTo(@NonNull
                            java.io.File file,
                            @NonNull
                            java.io.File to)
                     throws java.io.IOException
Throws:
java.io.IOException

join

@NonNull
public static java.io.File join(@NonNull
                                        java.io.File dir,
                                        @NonNull
                                        java.lang.String... paths)
Joins a list of path segments to a given File object.

Parameters:
dir - the file object.
paths - the segments.
Returns:
a new File object.

join

@NonNull
public static java.io.File join(@NonNull
                                        java.io.File dir,
                                        @NonNull
                                        java.lang.Iterable<java.lang.String> paths)
Joins a list of path segments to a given File object.

Parameters:
dir - the file object.
paths - the segments.
Returns:
a new File object.

join

@NonNull
public static java.lang.String join(@NonNull
                                            java.lang.String... paths)
Joins a set of segment into a string, separating each segments with a host-specific path separator.

Parameters:
paths - the segments.
Returns:
a string with the segments.

join

@NonNull
public static java.lang.String join(@NonNull
                                            java.lang.Iterable<java.lang.String> paths)
Joins a set of segment into a string, separating each segments with a host-specific path separator.

Parameters:
paths - the segments.
Returns:
a string with the segments.

loadFileWithUnixLineSeparators

@NonNull
public static java.lang.String loadFileWithUnixLineSeparators(@NonNull
                                                                      java.io.File file)
                                                       throws java.io.IOException
Loads a text file forcing the line separator to be of Unix style '\n' rather than being Windows style '\r\n'.

Throws:
java.io.IOException

relativePath

@NonNull
public static java.lang.String relativePath(@NonNull
                                                    java.io.File file,
                                                    @NonNull
                                                    java.io.File dir)

relativePossiblyNonExistingPath

@NonNull
public static java.lang.String relativePossiblyNonExistingPath(@NonNull
                                                                       java.io.File file,
                                                                       @NonNull
                                                                       java.io.File dir)

toSystemDependentPath

@NonNull
public static java.lang.String toSystemDependentPath(@NonNull
                                                             java.lang.String path)

sha1

@NonNull
public static java.lang.String sha1(@NonNull
                                            java.io.File file)
                             throws java.io.IOException
Throws:
java.io.IOException

getAllFiles

@NonNull
public static com.google.common.collect.FluentIterable<java.io.File> getAllFiles(@NonNull
                                                                                         java.io.File dir)

getNamesAsCommaSeparatedList

@NonNull
public static java.lang.String getNamesAsCommaSeparatedList(@NonNull
                                                                    java.lang.Iterable<java.io.File> files)