public class FPUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
Constructor and Description |
---|
FPUtil() |
Modifier and Type | Method and Description |
---|---|
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 outStream)
Convenient Method to get a ContentHandler to parse an UTF-8 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.
|
public static final java.lang.String REVISION
public static Repository getJCMSMainRepository()
public static java.lang.String getFirstWord(java.lang.String phrase)
phrase
- the phrasepublic static org.xml.sax.ContentHandler getXmlTextContentHandler(java.io.OutputStream outStream)
outStream
- the stream in which to write extracted text contentpublic 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 instanciatepublic 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 OSpublic static java.lang.String getFileVeryShortName(java.lang.String fileName)
fileName
- the filenamepublic static java.lang.String[] getFilesVeryShortName(java.lang.String[] filesName)
filesName
- the filenamepublic 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
- the filepublic static boolean checkIsGeneratedPlainText(java.io.File file)
file
- the filepublic static boolean isPlainText(java.io.File file)
public static void createAssociatedTextFile(java.io.File file, java.lang.String content)
file
- the filecontent
- the contenupublic static java.lang.String readAssociatedTextFileContent(java.io.File associatedTextFile)
associatedTextFile
- the associated text File to readpublic 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 processProcessingException
- if an error occursCopyright © 2001-2017 Jalios SA. All Rights Reserved.