net.sf.sparql.benchmarking.util
Class FileUtils

java.lang.Object
  extended by net.sf.sparql.benchmarking.util.FileUtils

public class FileUtils
extends Object

Helper class with utility methods related to files

Author:
rvesse

Method Summary
static boolean checkFile(File f, boolean allowOverwrite)
          Checks whether a given path is a file, does not exist (unless allowOverwrite is true) and is writable
static boolean checkFile(String filename, boolean allowOverwrite)
          Checks whether a given path is a file, does not exist (unless allowOverwrite is true) and is writable
static String getExtension(File file, boolean includeMultipleExtensions, boolean includeLeadingDot)
          Gets the extension for a given file
static String getExtension(String path, boolean includeMultipleExtensions, boolean includeLeadingDot)
          Gets the extension for a given path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkFile

public static boolean checkFile(String filename,
                                boolean allowOverwrite)
Checks whether a given path is a file, does not exist (unless allowOverwrite is true) and is writable

Parameters:
filename - Filename to check
allowOverwrite - Whether overwriting of existing files is allowed
Returns:
True if the file is usable, false otherwise

checkFile

public static boolean checkFile(File f,
                                boolean allowOverwrite)
Checks whether a given path is a file, does not exist (unless allowOverwrite is true) and is writable

Parameters:
f - File to check
allowOverwrite - Whether overwriting of existing files is allowed
Returns:
True if the file is usable, false otherwise

getExtension

public static String getExtension(String path,
                                  boolean includeMultipleExtensions,
                                  boolean includeLeadingDot)
                           throws IOException
Gets the extension for a given path

Parameters:
path - Path
includeMultipleExtensions - Whether multiple extensions are returned e.g. .txt.gz
includeLeadingDot - Whether the leading . on the extension is returned
Returns:
Extension
Throws:
IOException - Thrown if the path is not a file

getExtension

public static String getExtension(File file,
                                  boolean includeMultipleExtensions,
                                  boolean includeLeadingDot)
                           throws IOException
Gets the extension for a given file

Parameters:
file - File
includeMultipleExtensions - Whether multiple extensions are returned e.g. .txt.gz
includeLeadingDot - Whether the leading . on the extension is returned
Returns:
Extension
Throws:
IOException - Thrown if the filename


Copyright © 2014. All Rights Reserved.