phenote.util
Class FileUtil

java.lang.Object
  extended by phenote.util.FileUtil

public class FileUtil
extends java.lang.Object


Field Summary
static java.lang.String DASH
           
static java.lang.String DOT
           
static java.lang.String FILE_SEPARATOR
           
static java.lang.String UNDERSCORE
           
 
Constructor Summary
FileUtil()
           
 
Method Summary
static java.io.File archiveFile(java.io.File file, java.io.File archiveDirectory)
          This method moves (renames) a given file into an archive directory.
static java.io.File archiveFile(java.io.File file, java.lang.String archiveFolderPath, java.lang.String archiveFolderName)
          This method moves (renames) a given file into an archive directory.
static boolean copyFile(java.net.URL fromUrl, java.io.File toFile)
          some content from @link http://www.java2s.com/Code/Java/File-Input-Output/CopyfilesusingJavaIOAPI.htm
static boolean copyFileIntoArchive(java.io.File file, java.io.File archiveFile)
          Copy one file into another file.
static java.net.URL findUrl(java.lang.String filename)
          split into findMaster?ConfigUrl & findOboUrl!!!
static java.io.File getDotPhenoteConfDir()
           
static java.io.File getDotPhenoteDir()
          if ~/.phenote doesnt exist yet its created
static java.io.File getDotPhenoteOboDir()
           
static java.lang.String getFileSize(java.net.URL url)
           
static java.lang.String getLastModifiedDate(java.net.URL localUrl)
           
static java.lang.String getNameOfFile(java.lang.String path)
           
static java.lang.String getNameOfFile(java.net.URL urlFile)
          get actual name of file sans path
static java.lang.String getPureFileName(java.lang.String filename)
          Strip off all the path information from a file name.
static java.lang.String getRemoteFileSize(java.net.URL url)
           
static void purgeArchiveDirectory(java.io.File archiveDirectory, long purgeTime)
          Purge an archive directory for files that are older than the purge time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR

DASH

public static final java.lang.String DASH
See Also:
Constant Field Values

UNDERSCORE

public static final java.lang.String UNDERSCORE
See Also:
Constant Field Values

DOT

public static final java.lang.String DOT
See Also:
Constant Field Values
Constructor Detail

FileUtil

public FileUtil()
Method Detail

getDotPhenoteDir

public static java.io.File getDotPhenoteDir()
if ~/.phenote doesnt exist yet its created


getDotPhenoteOboDir

public static java.io.File getDotPhenoteOboDir()

getDotPhenoteConfDir

public static java.io.File getDotPhenoteConfDir()

getNameOfFile

public static java.lang.String getNameOfFile(java.net.URL urlFile)
get actual name of file sans path


getNameOfFile

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

findUrl

public static java.net.URL findUrl(java.lang.String filename)
                            throws java.io.FileNotFoundException
split into findMaster?ConfigUrl & findOboUrl!!!

Throws:
java.io.FileNotFoundException

archiveFile

public static java.io.File archiveFile(java.io.File file,
                                       java.lang.String archiveFolderPath,
                                       java.lang.String archiveFolderName)
This method moves (renames) a given file into an archive directory. The file name is changed to include a time stamp.

Parameters:
file -
archiveFolderPath -
archiveFolderName -

archiveFile

public static java.io.File archiveFile(java.io.File file,
                                       java.io.File archiveDirectory)
This method moves (renames) a given file into an archive directory. The file name is changed to include a time stamp: original file name: archived file name: The archive file is returned. The original file is removed. The archive directory is created if it does not exist.

Parameters:
file - file that should be archived
archiveDirectory -
Returns:
File archive file

copyFileIntoArchive

public static boolean copyFileIntoArchive(java.io.File file,
                                          java.io.File archiveFile)
Copy one file into another file.

Parameters:
file -
archiveFile -

copyFile

public static boolean copyFile(java.net.URL fromUrl,
                               java.io.File toFile)
                        throws java.io.IOException
some content from @link http://www.java2s.com/Code/Java/File-Input-Output/CopyfilesusingJavaIOAPI.htm

Throws:
java.io.IOException

purgeArchiveDirectory

public static void purgeArchiveDirectory(java.io.File archiveDirectory,
                                         long purgeTime)
Purge an archive directory for files that are older than the purge time.

Parameters:
archiveDirectory -
purgeTime - in milliseconds

getPureFileName

public static java.lang.String getPureFileName(java.lang.String filename)
Strip off all the path information from a file name.

Parameters:
filename -

getLastModifiedDate

public static java.lang.String getLastModifiedDate(java.net.URL localUrl)

getFileSize

public static java.lang.String getFileSize(java.net.URL url)

getRemoteFileSize

public static java.lang.String getRemoteFileSize(java.net.URL url)