|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.misc.LyFileTools
public class LyFileTools
This class offers general useful methods to manipulate files content.
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
Constructor Summary | |
---|---|
LyFileTools(LyEnvironment environment)
Constructor.Only initializes the current environment with the given one. |
Method Summary | |
---|---|
static boolean |
compareTempFiles(java.lang.String fileName1,
java.lang.String fileName2)
compare if tempFiles could assumed to be the same |
java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File directory,
boolean keepFileName)
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. |
static java.lang.String |
decodeFile(LyEnvironment environment,
java.lang.String encodingCharset,
java.lang.String inputFileName,
java.lang.String outputFileName)
Decode the input file in the given output file with the given charset. |
static java.lang.String |
encodeFile(LyEnvironment environment,
java.lang.String encodingCharset,
java.lang.String inputFileName,
java.lang.String outputFileName)
Encode the input file in the given output file with the given charset. |
static java.lang.String |
getFileName(java.lang.String path)
Extracts the filename from the specified PATH. |
static java.lang.String |
getFileSuffix(java.lang.String path)
Extracts the suffix (like .gif .doc) from the specified PATH. |
static java.lang.String |
getMimeType(java.lang.String fileName)
find a probable mimetype from file extension. |
static java.lang.String |
getSuffixFromMimeType(java.lang.String mimeType)
find a probable from file extension from given mimetype. |
static java.lang.String |
native2ascii(LyEnvironment environment,
boolean reverse,
java.lang.String encodingCharset,
java.lang.String inputFileName,
java.lang.String outputFileName)
Method to use the native2ascii Java tool. |
static java.lang.String |
removeFileCounter(java.lang.String path)
Extracts the suffix (like .gif .doc) from the specified PATH |
static boolean |
replaceKey(LyEnvironment environment,
java.io.Writer out,
java.io.BufferedReader in,
java.util.Hashtable<java.lang.String,java.lang.String> equivalent)
Replaces all keys found in the in Buffer with the equivalent String value found
in the equivalent Hashtable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String __VERSION
Constructor Detail |
---|
public LyFileTools(LyEnvironment environment)
environment
- The environment that must be used.Method Detail |
---|
public static boolean replaceKey(LyEnvironment environment, java.io.Writer out, java.io.BufferedReader in, java.util.Hashtable<java.lang.String,java.lang.String> equivalent)
in
Buffer with the equivalent String value found
in the equivalent
Hashtable.
environment
- The environment within the operation occured.out
- The output filein
- The input fileequivalent
- The hastable Key->Replacement String.
public static java.lang.String getFileName(java.lang.String path)
path
- input path
public static java.lang.String getFileSuffix(java.lang.String path)
path
- input path
public static java.lang.String removeFileCounter(java.lang.String path)
path
- input path
public static java.lang.String encodeFile(LyEnvironment environment, java.lang.String encodingCharset, java.lang.String inputFileName, java.lang.String outputFileName)
environment
- the application environmentencodingCharset
- the charset used to encode the input fileinputFileName
- the input file nameoutputFileName
- the output file name. If null the result of encoding is redirect to
the current output stream.
public static java.lang.String decodeFile(LyEnvironment environment, java.lang.String encodingCharset, java.lang.String inputFileName, java.lang.String outputFileName)
environment
- the application environmentencodingCharset
- the input file charset used to decode itinputFileName
- the input file nameoutputFileName
- the output file name. If null the result of encoding is redirect to
the current output stream.
public static java.lang.String native2ascii(LyEnvironment environment, boolean reverse, java.lang.String encodingCharset, java.lang.String inputFileName, java.lang.String outputFileName)
Java tool synopsis :
native2ascii [-reverse] [-encoding encoding_name] [inputfile [outputfile]]
-reverse
:
Perform the reverse operation: convert a file with Latin-1 and/ or Unicode encoded characters to one with native-encoded characters.
-encoding encoding_name
:
Specify the encoding name which is used by the conversion procedure. The default encoding is taken from System property file.encoding. The encoding_name string must be taken from the first column of the table of supported encodings in the Supported Encodings document.
inputfile
:
The input file name. If, in addition, inputfile is omitted, standard input is used for input.
outputfile
:
The output file name. If it is omitted, standard output is used for output.
environment
- the application environmentreverse
- indicates if the reverse operation has to be preformend or notencodingCharset
- the encoding charsetinputFileName
- the input file name. If null, this method does nothingoutputFileName
- the input file name. If null, write the result in the standard
output.
public static java.lang.String getMimeType(java.lang.String fileName)
fileName
- fine path
public static java.lang.String getSuffixFromMimeType(java.lang.String mimeType)
the
- mimetype if found or null if non valid arguments.
public java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File directory, boolean keepFileName) throws java.io.IOException
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name.
prefix
- The prefix string to be used in generating the file's
name; must be at least three characters longsuffix
- The suffix string to be used in generating the file's
name; may be null
, in which case the
suffix ".tmp"
will be useddirectory
- The directory in which the file is to be created, or
null
if the default temporary-file
directory is to be usedkeepFileName
- Try to keep filename if possible, or
java.lang.IllegalArgumentException
- If the prefix
argument contains fewer than three
characters
java.io.IOException
- If a file could not be createdpublic static boolean compareTempFiles(java.lang.String fileName1, java.lang.String fileName2)
compare if tempFiles could assumed to be the same
String
- fileName1 first fileString
- fileName2 second file
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |