|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jalios.jcms.fileprocessor.FPUtil
public class FPUtil
This class provides a set of static methods which perform various utility operations used specifically in FileProcessor.
Field Summary | |
---|---|
static String |
REVISION
|
Constructor Summary | |
---|---|
FPUtil()
|
Method Summary | |
---|---|
static boolean |
arrayContainsIgnoreCase(String[] array,
String key)
Test if an array contains a given object. |
static boolean |
checkIsGeneratedPDF(File file)
Check if the file in parameter is the generated PDF associated to another document. |
static boolean |
checkIsGeneratedPlainText(File file)
Check if the file in parameter is the generated Plain text associated to another document. |
static void |
createAssociatedTextFile(File file,
String content)
Create a file with name the name of file plus ".txt" and with content : content. |
static String |
extractTextPDF(File file,
Map<String,Object> ctxt,
FileParser parser)
This methods extracts the text of specified PDF File (MUST be a pdf) to a String (using PDFBox). |
static String |
fromInnerFileSeparatorToSystemFileSeparator(String filename)
Returns filename using System separator caracter |
static String |
fromSystemFileSeparatorToInnerFileSeparator(String filename)
Returns filename using inner separator caracter |
static Comparator<FileActionComponent> |
getActionComponentComparator()
This comparator is to order FileActionComponent in regard with getOrder. |
static FileActionComponent |
getActionComponentInstance(Class<? extends FileActionComponent> clazz)
Returns a new instance of a FileActionComponent of the class specified in parameter. |
static File |
getAssociatedTextFile(File file)
Retrieve the File instance of the associated text file for the specified File |
static Comparator<Class<?>> |
getClassComparator()
Comparator for Classes, usefull to use TreeSet of Classes, then ObjectIntTreeMap with classes as keys. |
static String |
getFileShortName(File file,
Repository repository)
|
static String[] |
getFilesVeryShortName(String[] filesName)
This method give the ending name of a file. |
static String |
getFileVeryShortName(String fileName)
This method give the ending name of a file. |
static String |
getFirstWord(String phrase)
Return the substring of the phrase in parameter before the first dot, or itself if it contains no dot. |
static Repository |
getJCMSMainRepository()
Gives the main repository for JCMS upload files. |
static String |
getTextFileName(File file)
Retrieve the absolute file name of the associated text file for the specified File |
static ContentHandler |
getXmlTextContentHandler(OutputStream pout)
Convenient Method to get a ContentHandler to parse XML stream and get only text inside element. |
static boolean |
isPlainText(File file)
|
static String |
readAssociatedTextFileContent(File associatedTextFile)
Read the content of the specified text file and return it as a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public FPUtil()
Method Detail |
---|
public static Repository getJCMSMainRepository()
public static String getFirstWord(String phrase)
phrase
-
public static ContentHandler getXmlTextContentHandler(OutputStream pout)
pout
- XML stream
public static boolean arrayContainsIgnoreCase(String[] array, String key)
array
- the array to be searched.key
- the value to be searched for.
public static FileActionComponent getActionComponentInstance(Class<? extends FileActionComponent> clazz)
clazz
- the FileActionComponent class to instanciate
public static Comparator<FileActionComponent> getActionComponentComparator()
public static String fromInnerFileSeparatorToSystemFileSeparator(String filename)
filename
- as stored (independant from OS)
public static String fromSystemFileSeparatorToInnerFileSeparator(String filename)
filename
- close to OS
public static String getFileVeryShortName(String fileName)
fileName
-
public static String[] getFilesVeryShortName(String[] filesName)
filesName
-
public static String getFileShortName(File file, Repository repository)
public static Comparator<Class<?>> getClassComparator()
public static boolean checkIsGeneratedPDF(File file)
file
-
public static boolean checkIsGeneratedPlainText(File file)
file
-
public static boolean isPlainText(File file)
public static void createAssociatedTextFile(File file, String content)
file
- content
- public static String readAssociatedTextFileContent(File associatedTextFile)
associatedTextFile
- the associated text File to read
public static String getTextFileName(File file)
file
- any file for which to retrieve the associated text file path.
public static File getAssociatedTextFile(File file)
file
- any file for which to retrieve the associated text File.
public static String extractTextPDF(File file, Map<String,Object> ctxt, FileParser parser) throws ProcessingException
This methods is meant to be used in a FileParser implementation and requires all parameters
file
- the PDF file (must be a valid and existing PDF file)ctxt
- the FileParser extractText context mapparser
- the FileParser instance performing the parsing process
ProcessingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |