com.generationjava.io
Class FileW

java.lang.Object
  |
  +--com.generationjava.io.FileW

public final class FileW
extends java.lang.Object

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


Constructor Summary
FileW()
           
 
Method Summary
static java.lang.String dottify(java.lang.String in)
          Changes File.separator to dots in a pathname.
static java.io.File[] findFiles(java.lang.String str)
           
static java.io.File[] findFiles(java.lang.String str, java.io.File directory)
           
static java.lang.String getClassName(java.io.File file)
          What is the full classname of this file.
static java.lang.String loadFile(java.io.File file)
          Load the contents of a given java.io.File.
static java.lang.String loadFile(java.io.InputStream in)
          Load the contents of a given stream.
static java.lang.String loadFile(java.lang.String filename)
          Load the contents of a given filename.
static java.lang.String loadFile(java.net.URL url)
          Load the contents of a given url.
static java.lang.String loadFromClasspath(java.lang.String file)
           
static java.lang.String loadFromClasspath(java.lang.String file, java.lang.ClassLoader loader)
           
static java.lang.String loadFromClasspath(java.lang.String file, java.lang.Object instance)
           
static java.lang.String removeExtension(java.lang.String in)
          If a filename has an extension, then it removes this.
static java.lang.String removePwd(java.lang.String in)
          Removes the present working directory of a filename
static boolean saveFile(java.lang.String filename, java.lang.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 java.lang.String loadFile(java.lang.String filename)
Load the contents of a given filename. Return null if the file is not loadable.


loadFile

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


loadFile

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


loadFile

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


loadFromClasspath

public static java.lang.String loadFromClasspath(java.lang.String file)

loadFromClasspath

public static java.lang.String loadFromClasspath(java.lang.String file,
                                                 java.lang.Object instance)

loadFromClasspath

public static java.lang.String loadFromClasspath(java.lang.String file,
                                                 java.lang.ClassLoader loader)

saveFile

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

Returns:
boolean did the save work.

getClassName

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

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

removePwd

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

Parameters:
in - String pathname
Returns:
String relative pathname

removeExtension

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

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

dottify

public static java.lang.String dottify(java.lang.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 java.io.File[] findFiles(java.lang.String str)

findFiles

public static java.io.File[] findFiles(java.lang.String str,
                                       java.io.File directory)


Copyright © 2000-2003 OSJava. All Rights Reserved.