Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.atomikos.util
Class IOHelper

    java.lang.Object
      com.atomikos.util.IOHelper

    public class IOHelper

extends Object

A helper class for common IO tasks.

Constructor Summary
`IOHelper()`

Method Summary
`static void` | `copyBytes(InputStream in, OutputStream out)` Copy every byte from the source to the output.
`static boolean` | `createPathTo(File file, boolean isDirectory)` Recursively create the path to the given file if it does not exist.
`static boolean` | `deleteContents(File folder)` Recursively delete the contents of the given folder.
`static String` | `getDifferencePath(File fromFolder, File toFile)` Get the difference path of a file wrt a folder.
`static String` | `getRelativePath(File fromFolder, File toFile)` Gets the relative path of a file wrt one of its parent directories.

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

Constructor Detail

### IOHelper

    public IOHelper()

Method Detail

### copyBytes

    public static void copyBytes(InputStream in,
                                 OutputStream out)
                          throws IOException

  Copy every byte from the source to the output.

  Parameters:
    `in` - The source stream.
    `out` - The output stream.
  Throws:
    `IOException` - On IO errors.

### getRelativePath

    public static String getRelativePath(File fromFolder,
                                         File toFile)
                                  throws IOException

  Gets the relative path of a file wrt one of its parent directories.

  Parameters:
    `fromFolder` - The parent directory
    `toFile` - The file
  Returns:
    String The relative path
  Throws:
    `IOException` - On error, for instance if toFile is not in fromFolder

### getDifferencePath

    public static String getDifferencePath(File fromFolder,
                                           File toFile)
                                    throws IOException

  Get the difference path of a file wrt a folder.

  Parameters:
    `fromFolder` - The folder.
    `toFile` - The file. This file should be contained in the parent of fromFolder!
  Returns:
    String The path from the parent of fromFolder to toFile.
  Throws:
    `IOException`

### createPathTo

    public static boolean createPathTo(File file,
                                       boolean isDirectory)
                                throws IOException

  Recursively create the path to the given file if it does not exist.

  Parameters:
    `file` - The file to create. All nonexistent parent folders will also be created.
    `isDirectory` - True iff the file should be a directory
  Returns:
    boolean True if success.
  Throws:
    `IOException`

### deleteContents

    public static boolean deleteContents(File folder)
                                  throws IOException

  Recursively delete the contents of the given folder.

  Parameters:
    `folder` - The folder to delete.
  Returns:
    boolean True if success.
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.