de.smartics.util.io
Class FileFunction

Package class diagram package FileFunction
java.lang.Object
  extended by de.smartics.util.io.FileFunction

public final class FileFunction
     
     
extends Object

Functions dealing with Files and Streams.


Method Summary
static void provideDirectory(File directory)
          Checks if the given directory exits and if not, creates it.
static File provideDirectory(String directoryName)
          Checks if a directory with the given name exits and if not, creates it.
static void writeToFile(InputStream input, File file)
          Writes the given stream to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeToFile

public static void writeToFile(InputStream input,
                               File file)
                        throws IOException
Writes the given stream to the given file.

Parameters:
input - the stream to read from.
file - the file to write to.
Throws:
IOException - on any problem copying the stream contents to the file.

provideDirectory

public static File provideDirectory(String directoryName)
                             throws IOException
Checks if a directory with the given name exits and if not, creates it.

Parameters:
directoryName - the name of the directory to ensure to exist.
Returns:
a reference to the created file.
Throws:
IOException - if the directory cannot be created.

provideDirectory

public static void provideDirectory(File directory)
                             throws IOException
Checks if the given directory exits and if not, creates it.

Parameters:
directory - the directory to ensure to exist.
Throws:
IOException - if the directory cannot be created.


Copyright © 2011-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.