us.ihmc.utilities
Class FileTools

java.lang.Object
  extended by us.ihmc.utilities.FileTools

public class FileTools
extends java.lang.Object


Constructor Summary
FileTools()
           
 
Method Summary
static void concatenateFilesTogether(java.util.ArrayList<java.lang.String> filenames, java.lang.String concatenatedFilename)
           
static long countLinesInJavaFilesInDirectory(java.lang.String directory)
          Counts the number of lines in Java Files in directory
static java.util.ArrayList<java.io.File> getAllFilesInDirectoryRecursive(java.io.File directory)
          Gets all files in the directory through recursive calls
static java.util.ArrayList<java.io.File> getAllFilesInDirectoryWithSuffix(java.lang.String suffix, java.io.File directory)
           
static java.io.DataInputStream getFileDataInputStream(java.lang.String filename)
           
static java.io.DataOutputStream getFileDataOutputStream(java.lang.String filename)
           
static java.lang.String getFilenameFromPath(java.lang.String path)
           
static java.lang.String getFilenameWithoutFileType(java.lang.String filename)
           
static java.io.BufferedReader getFileReader(java.lang.String filename)
           
static java.lang.String getFileType(java.lang.String filename)
           
static java.io.PrintWriter getFileWriter(java.lang.String filename)
           
static java.io.PrintWriter getFileWriterWithAppend(java.lang.String filename)
           
static java.lang.String getRootPathFromPath(java.lang.String path)
           
static java.io.File showSaveFileDialogBox(java.io.File parentFile, java.awt.Component parentComponent)
          presents a "Save file" dialog box to the user, opened to the given parent file, parented to the given component.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTools

public FileTools()
Method Detail

concatenateFilesTogether

public static void concatenateFilesTogether(java.util.ArrayList<java.lang.String> filenames,
                                            java.lang.String concatenatedFilename)
                                     throws java.io.FileNotFoundException,
                                            java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getFilenameWithoutFileType

public static java.lang.String getFilenameWithoutFileType(java.lang.String filename)

getFileType

public static java.lang.String getFileType(java.lang.String filename)

getRootPathFromPath

public static java.lang.String getRootPathFromPath(java.lang.String path)

getFilenameFromPath

public static java.lang.String getFilenameFromPath(java.lang.String path)

getFileReader

public static java.io.BufferedReader getFileReader(java.lang.String filename)
                                            throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

getFileWriter

public static java.io.PrintWriter getFileWriter(java.lang.String filename)
                                         throws java.io.FileNotFoundException,
                                                java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getFileWriterWithAppend

public static java.io.PrintWriter getFileWriterWithAppend(java.lang.String filename)
                                                   throws java.io.FileNotFoundException,
                                                          java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getFileDataOutputStream

public static java.io.DataOutputStream getFileDataOutputStream(java.lang.String filename)
                                                        throws java.io.FileNotFoundException,
                                                               java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getFileDataInputStream

public static java.io.DataInputStream getFileDataInputStream(java.lang.String filename)
                                                      throws java.io.FileNotFoundException,
                                                             java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

showSaveFileDialogBox

public static java.io.File showSaveFileDialogBox(java.io.File parentFile,
                                                 java.awt.Component parentComponent)
presents a "Save file" dialog box to the user, opened to the given parent file, parented to the given component. Returns the chosen file, if any. If the user cancelled the dialog, returns null.

Parameters:
parentFile - File
parentComponent - Component
Returns:
File

countLinesInJavaFilesInDirectory

public static long countLinesInJavaFilesInDirectory(java.lang.String directory)
                                             throws java.io.IOException
Counts the number of lines in Java Files in directory

Parameters:
directory - String
Returns:
long
Throws:
java.io.IOException

getAllFilesInDirectoryRecursive

public static java.util.ArrayList<java.io.File> getAllFilesInDirectoryRecursive(java.io.File directory)
Gets all files in the directory through recursive calls

Parameters:
directory - File
Returns:
ArrayList

getAllFilesInDirectoryWithSuffix

public static java.util.ArrayList<java.io.File> getAllFilesInDirectoryWithSuffix(java.lang.String suffix,
                                                                                 java.io.File directory)