|
||||||||||
| 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 java.lang.String |
REVISION
|
| Constructor Summary | |
|---|---|
FPUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
arrayContainsIgnoreCase(java.lang.String[] array,
java.lang.String key)
Test if an array contains a given object. |
static boolean |
checkIsGeneratedPDF(java.io.File file)
Check if the file in parameter is the generated PDF associated to another document. |
static boolean |
checkIsGeneratedPlainText(java.io.File file)
Check if the file in parameter is the generated Plain text associated to another document. |
static void |
createAssociatedTextFile(java.io.File file,
java.lang.String content)
Create a file with name the name of file plus ".txt" and with content : content. |
static java.lang.String |
extractTextPDF(java.io.File file,
java.util.Map<java.lang.String,java.lang.Object> ctxt,
FileParser parser)
This methods extracts the text of specified PDF File (MUST be a pdf) to a String (using PDFBox). |
static java.lang.String |
fromInnerFileSeparatorToSystemFileSeparator(java.lang.String filename)
Returns filename using System separator caracter |
static java.lang.String |
fromSystemFileSeparatorToInnerFileSeparator(java.lang.String filename)
Returns filename using inner separator caracter |
static java.util.Comparator<FileActionComponent> |
getActionComponentComparator()
This comparator is to order FileActionComponent in regard with getOrder. |
static FileActionComponent |
getActionComponentInstance(java.lang.Class<? extends FileActionComponent> clazz)
Returns a new instance of a FileActionComponent of the class specified in parameter. |
static java.io.File |
getAssociatedTextFile(java.io.File file)
Retrieve the File instance of the associated text file for the specified File |
static java.util.Comparator<java.lang.Class<?>> |
getClassComparator()
Comparator for Classes, usefull to use TreeSet of Classes, then ObjectIntTreeMap with classes as keys. |
static java.lang.String |
getFileShortName(java.io.File file,
Repository repository)
|
static java.lang.String[] |
getFilesVeryShortName(java.lang.String[] filesName)
This method give the ending name of a file. |
static java.lang.String |
getFileVeryShortName(java.lang.String fileName)
This method give the ending name of a file. |
static java.lang.String |
getFirstWord(java.lang.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 java.lang.String |
getTextFileName(java.io.File file)
Retrieve the absolute file name of the associated text file for the specified File |
static org.xml.sax.ContentHandler |
getXmlTextContentHandler(java.io.OutputStream pout)
Convenient Method to get a ContentHandler to parse XML stream and get only text inside element. |
static boolean |
isPlainText(java.io.File file)
|
static java.lang.String |
readAssociatedTextFileContent(java.io.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 java.lang.String REVISION
| Constructor Detail |
|---|
public FPUtil()
| Method Detail |
|---|
public static Repository getJCMSMainRepository()
public static java.lang.String getFirstWord(java.lang.String phrase)
phrase -
public static org.xml.sax.ContentHandler getXmlTextContentHandler(java.io.OutputStream pout)
pout - XML stream
public static boolean arrayContainsIgnoreCase(java.lang.String[] array,
java.lang.String key)
array - the array to be searched.key - the value to be searched for.
public static FileActionComponent getActionComponentInstance(java.lang.Class<? extends FileActionComponent> clazz)
clazz - the FileActionComponent class to instanciate
public static java.util.Comparator<FileActionComponent> getActionComponentComparator()
public static java.lang.String fromInnerFileSeparatorToSystemFileSeparator(java.lang.String filename)
filename - as stored (independant from OS)
public static java.lang.String fromSystemFileSeparatorToInnerFileSeparator(java.lang.String filename)
filename - close to OS
public static java.lang.String getFileVeryShortName(java.lang.String fileName)
fileName -
public static java.lang.String[] getFilesVeryShortName(java.lang.String[] filesName)
filesName -
public static java.lang.String getFileShortName(java.io.File file,
Repository repository)
public static java.util.Comparator<java.lang.Class<?>> getClassComparator()
public static boolean checkIsGeneratedPDF(java.io.File file)
file -
public static boolean checkIsGeneratedPlainText(java.io.File file)
file -
public static boolean isPlainText(java.io.File file)
public static void createAssociatedTextFile(java.io.File file,
java.lang.String content)
file - content - public static java.lang.String readAssociatedTextFileContent(java.io.File associatedTextFile)
associatedTextFile - the associated text File to read
public static java.lang.String getTextFileName(java.io.File file)
file - any file for which to retrieve the associated text file path.
public static java.io.File getAssociatedTextFile(java.io.File file)
file - any file for which to retrieve the associated text File.
public static java.lang.String extractTextPDF(java.io.File file,
java.util.Map<java.lang.String,java.lang.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 | |||||||||