## com.bbn.openmap.util
Class FileUtils

    java.lang.Object
      com.bbn.openmap.util.FileUtils

public class FileUtils
extends java.lang.Object

Constructor Summary
`FileUtils()`

Method Summary
`static void` `copy(java.io.File fromFile, java.io.File toFile, int bufSize)` Copy a file to another location, byte-wise.
`static javax.swing.JFileChooser` `getChooser(java.lang.String title)`
`static java.lang.String` `getFilePathToOpenFromUser(java.lang.String title)`
`static java.lang.String` `getFilePathToOpenFromUser(java.lang.String title, javax.swing.filechooser.FileFilter ff)`
`static java.lang.String` `getFilePathToSaveFromUser(java.lang.String title)`
`static java.lang.String` `getPathToOpenFromUser(java.lang.String title, javax.swing.filechooser.FileFilter ff, int fileSelectionMode, java.lang.String acceptButtonText)`
`static java.lang.String` `handleResponse(javax.swing.JFileChooser chooser, int state)`
`static void` `openZipFile(java.lang.String zipFileName, java.io.File toDir, boolean deleteAfter)` Unpack a zip file.
`static void` `saveZipFile(java.lang.String zipFileName, java.io.File toBeZipped)` Create a zip file containing the given File.
`protected static void` `unzip(java.util.zip.ZipInputStream zin, java.io.File f)`
`protected static void` `writeZipEntry(java.io.File toBeZipped, java.util.zip.ZipOutputStream zoStream, int prefixTrimLength)`
`protected static void` `writeZipEntry(java.io.File fromFile, java.util.zip.ZipOutputStream zoStream, java.lang.String entryName)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileUtils

    public FileUtils()

Method Detail

### getFilePathToSaveFromUser

    public static java.lang.String getFilePathToSaveFromUser(java.lang.String title)

### getFilePathToOpenFromUser

    public static java.lang.String getFilePathToOpenFromUser(java.lang.String title)

### getFilePathToOpenFromUser

    public static java.lang.String getFilePathToOpenFromUser(java.lang.String title,
                                                             javax.swing.filechooser.FileFilter ff)

### getPathToOpenFromUser

    public static java.lang.String getPathToOpenFromUser(java.lang.String title,
                                                         javax.swing.filechooser.FileFilter ff,
                                                         int fileSelectionMode,
                                                         java.lang.String acceptButtonText)

### getChooser

    public static javax.swing.JFileChooser getChooser(java.lang.String title)

### handleResponse

    public static java.lang.String handleResponse(javax.swing.JFileChooser chooser,
                                                  int state)

### copy

    public static void copy(java.io.File fromFile,
                            java.io.File toFile,
                            int bufSize)
                     throws java.io.IOException

  Copy a file to another location, byte-wise.

  Parameters:
    `fromFile` - the File to copy from.
    `toFile` - the File to copy to.
    `bufSize` - the byte size of the transfer buffer.
  Throws:
    `java.io.IOException` - Thrown if anything goes wrong.

### saveZipFile

    public static void saveZipFile(java.lang.String zipFileName,
                                   java.io.File toBeZipped)
                            throws java.io.IOException,
                                   java.io.FileNotFoundException

  Create a zip file containing the given File.

  Parameters:
    `zipFileName` - The path to the zip file. If it doesn't end in .zip, .zip will be added to it.
    `toBeZipped` - The Path of the file/directory to be zipped.
  Throws:
    `java.io.IOException`
    `java.io.FileNotFoundException`

### writeZipEntry

    protected static void writeZipEntry(java.io.File toBeZipped,
                                        java.util.zip.ZipOutputStream zoStream,
                                        int prefixTrimLength)

### writeZipEntry

    protected static void writeZipEntry(java.io.File fromFile,
                                        java.util.zip.ZipOutputStream zoStream,
                                        java.lang.String entryName)

### openZipFile

    public static void openZipFile(java.lang.String zipFileName,
                                   java.io.File toDir,
                                   boolean deleteAfter)

  Unpack a zip file.

  Parameters:
    `zipFileName` - The path name of the zip file to unpack.
    `toDir` - the directory to put the unpacked files in.
    `deleteAfter` - flag to delete the zip file when complete.

### unzip

    protected static void unzip(java.util.zip.ZipInputStream zin,
                                java.io.File f)
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details