com.generationjava.io
Class FileW

java.lang.Object
  extended bycom.generationjava.io.FileW

public final class FileW
extends Object

Provides useful, standard behaviour for dealing with java.io.Files.


Constructor Summary
FileW()
           
 
Method Summary
static String dottify(String in)
          Changes File.separator to dots in a pathname.
static File[] findFiles(String str)
           
static File[] findFiles(String str, File directory)
           
static String getClassName(File file)
          What is the full classname of this file.
static String loadFile(File file)
          Load the contents of a given java.io.File.
static String loadFile(InputStream in)
          Load the contents of a given stream.
static String loadFile(String filename)
          Load the contents of a given filename.
static String loadFile(URL url)
          Load the contents of a given url.
static String loadFromClasspath(String file)
           
static String loadFromClasspath(String file, ClassLoader loader)
           
static String loadFromClasspath(String file, Object instance)
           
static String removeExtension(String in)
          If a filename has an extension, then it removes this.
static String removePwd(String in)
          Removes the present working directory of a filename
static boolean saveFile(String filename, String contents)
          Save a String to a file with the given filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileW

public FileW()
Method Detail

loadFile

public static String loadFile(String filename)
Load the contents of a given filename. Return null if the file is not loadable.


loadFile

public static String loadFile(InputStream in)
Load the contents of a given stream. Return null if the file is not loadable.


loadFile

public static String loadFile(URL url)
Load the contents of a given url. Return null if the file is not loadable.


loadFile

public static String loadFile(File file)
Load the contents of a given java.io.File. Return null if the file is not loadable.


loadFromClasspath

public static String loadFromClasspath(String file)

loadFromClasspath

public static String loadFromClasspath(String file,
                                       Object instance)

loadFromClasspath

public static String loadFromClasspath(String file,
                                       ClassLoader loader)

saveFile

public static boolean saveFile(String filename,
                               String contents)
Save a String to a file with the given filename.

Returns:
boolean did the save work.

getClassName

public static String getClassName(File file)
What is the full classname of this file.

Parameters:
file - File to find classname of
Returns:
String class name

removePwd

public static String removePwd(String in)
Removes the present working directory of a filename

Parameters:
in - String pathname
Returns:
String relative pathname

removeExtension

public static String removeExtension(String in)
If a filename has an extension, then it removes this.

Parameters:
in - String pathname
Returns:
String pathname without extension.

dottify

public static String dottify(String in)
Changes File.separator to dots in a pathname.

Parameters:
in - String pathname
Returns:
String pathname with dots instead of file separators.

findFiles

public static File[] findFiles(String str)

findFiles

public static File[] findFiles(String str,
                               File directory)


Copyright © 2000-2005 OSJava. All Rights Reserved.