play.libs

## Class Files

- java.lang.Object
- - play.libs.Files

    public class Files
    extends java.lang.Object

Files utils

### Field Summary

Fields
`static char[]` `ILLEGAL_FILENAME_CHARS` Characters that are invalid in Windows OS file names (Unix only forbids '/' character)
`static char` `ILLEGAL_FILENAME_CHARS_REPLACE`

### Constructor Summary

Constructors
Constructor and Description
`Files()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `copy(java.io.File from, java.io.File to)` Just copy a file
`static boolean` `copyDir(java.io.File from, java.io.File to)`
`static boolean` `delete(java.io.File file)` Just delete a file.
`static boolean` `deleteDirectory(java.io.File path)` Recursively delete a directory.
`static boolean` `isSameFile(java.io.File a, java.io.File b)` Indicate if two file refers to the same one
`static java.lang.String` `sanitizeFileName(java.lang.String fileName)` Replace all characters that are invalid in file names on Windows or Unix operating systems with `ILLEGAL_FILENAME_CHARS_REPLACE` character.
`static java.lang.String` `sanitizeFileName(java.lang.String fileName, char replacement)` Replace all characters that are invalid in file names on Windows or Unix operating systems with passed in character.
`static void` `unzip(java.io.File from, java.io.File to)`
`static void` `zip(java.io.File directory, java.io.File zipFile)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ILLEGAL_FILENAME_CHARS

    public static final char[] ILLEGAL_FILENAME_CHARS

Characters that are invalid in Windows OS file names (Unix only forbids '/' character)

#### ILLEGAL_FILENAME_CHARS_REPLACE

    public static final char ILLEGAL_FILENAME_CHARS_REPLACE

See Also:
  Constant Field Values

### Constructor Detail

#### Files

    public Files()

### Method Detail

#### isSameFile

    public static boolean isSameFile(java.io.File a,
                                     java.io.File b)

Indicate if two file refers to the same one

Parameters:
  `a` - First file to compare
  `b` - Second file to compare
Returns:
  true is file are the same

#### copy

    public static void copy(java.io.File from,
                            java.io.File to)

Just copy a file

Parameters:
  `from` - source of the file
  `to` - destination file

#### delete

    public static boolean delete(java.io.File file)

Just delete a file. If the file is a directory, it's work.

Parameters:
  `file` - The file to delete
Returns:
  true if and only if the file is successfully deleted; false otherwise

#### deleteDirectory

    public static boolean deleteDirectory(java.io.File path)

Recursively delete a directory.

Parameters:
  `path` - Path of the directory
Returns:
  true if and only if the directory is successfully deleted; false otherwise

#### copyDir

    public static boolean copyDir(java.io.File from,
                                  java.io.File to)

#### unzip

    public static void unzip(java.io.File from,
                             java.io.File to)

#### zip

    public static void zip(java.io.File directory,
                           java.io.File zipFile)

#### sanitizeFileName

    public static java.lang.String sanitizeFileName(java.lang.String fileName)

Replace all characters that are invalid in file names on Windows or Unix operating systems with `ILLEGAL_FILENAME_CHARS_REPLACE` character.

This method makes sure your file name can successfully be used to write new file to disk. Invalid characters are listed in `ILLEGAL_FILENAME_CHARS` array.

Parameters:
  `fileName` - File name to sanitize
Returns:
  Sanitized file name (new String object) if found invalid characters or same string if not

#### sanitizeFileName

    public static java.lang.String sanitizeFileName(java.lang.String fileName,
                                                    char replacement)

Replace all characters that are invalid in file names on Windows or Unix operating systems with passed in character.

This method makes sure your file name can successfully be used to write new file to disk. Invalid characters are listed in `ILLEGAL_FILENAME_CHARS` array.

Parameters:
  `fileName` - File name to sanitize
  `replacement` - character to use as replacement for invalid chars
Returns:
  Sanitized file name (new String object) if found invalid characters or same string if not