|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.psnc.vlab.util.FileTools
public class FileTools
FileTools
class - set of utility methods on files.
Field Summary | |
---|---|
static java.lang.String |
FILE_SEPARATOR
System file separator. |
static java.lang.String |
gif
|
static java.lang.String |
HOME_DIRECTORY
User home directory |
static java.lang.String |
IMAGE_DIRECTORY
Directory containing images |
static java.lang.String |
jgx
|
static java.lang.String |
jpeg
|
static java.lang.String |
jpg
|
static java.lang.String |
LINE_SEPARATOR
System line separator I.e. |
static java.lang.String |
png
|
static java.lang.String |
tif
|
static java.lang.String |
tiff
|
static java.lang.String |
WORKING_DIRECTORY
User working directory |
Constructor Summary | |
---|---|
FileTools()
|
Method Summary | |
---|---|
static void |
closeIgnoringException(java.io.Closeable c)
Close the given stream ignoring exceptions thrown |
static boolean |
fileExists(java.io.File file)
Check whether the specyfied file by this URL exists. |
static boolean |
fileExists(java.lang.String fileName)
Check whether the specyfied file by this URL exists. |
static java.lang.String |
getBase(java.lang.String fileName)
Get the file name without extension |
static java.lang.String |
getBase(java.net.URL url)
Get the url without extension |
static java.lang.String |
getClassNameWithoutPackage(java.lang.Class<?> cl)
Returns the classname without the package. |
static byte[] |
getContent(java.io.File file)
Reads the content of the given file into a byte array |
static byte[] |
getContent(java.io.InputStream inputStream)
Reads the content of the given input stream into a byte array |
static java.lang.String |
getExtension(java.io.File f)
Get the extension of a file. |
static java.lang.String |
getExtension(java.lang.String fileName)
Get the extension of a file by the file name |
static java.lang.String |
getResourceName(java.lang.String resAbsolutePath)
Get the resource name from its absolute path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String LINE_SEPARATOR
public static java.lang.String FILE_SEPARATOR
public static java.lang.String WORKING_DIRECTORY
public static java.lang.String HOME_DIRECTORY
public static java.lang.String IMAGE_DIRECTORY
public static final java.lang.String jpeg
public static final java.lang.String jpg
public static final java.lang.String gif
public static final java.lang.String tiff
public static final java.lang.String tif
public static final java.lang.String png
public static final java.lang.String jgx
Constructor Detail |
---|
public FileTools()
Method Detail |
---|
public static java.lang.String getExtension(java.io.File f)
f
- the file to be checked
public static java.lang.String getExtension(java.lang.String fileName)
fileName
- file name
public static java.lang.String getBase(java.lang.String fileName)
fileName
- name of the file
public static java.lang.String getBase(java.net.URL url)
url
- url to be converted
public static boolean fileExists(java.io.File file)
file
- the File representation of the given file
true
if the file exists, false
otherwisepublic static boolean fileExists(java.lang.String fileName)
fileName
- the file name
true
if the file exists, false
otherwisepublic static java.lang.String getClassNameWithoutPackage(java.lang.Class<?> cl)
cl
- The class to inspect
public static java.lang.String getResourceName(java.lang.String resAbsolutePath)
resAbsolutePath
- resource absolute path
public static byte[] getContent(java.io.InputStream inputStream)
inputStream
- input stream (InputStream
)
public static byte[] getContent(java.io.File file)
file
- current file
public static void closeIgnoringException(java.io.Closeable c)
c
- instance of Closeable
interface
|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |