public class AppsCommon extends Object
Modifier and Type | Field and Description |
---|---|
static Comparator<File> |
fileComp
Comparator sorts files alphabetically.
|
Constructor and Description |
---|
AppsCommon() |
Modifier and Type | Method and Description |
---|---|
static int |
getLastBarrelFromStateFile(String index)
Gets the number of the last barrel in given index.
|
static long |
getUID(String filename,
Tanker tanker)
Find a unique identificator for the document with given filename.
|
static boolean |
getUserApproval()
Ask the user for approval using commandline,
and return the response of the user.
|
static Barrel |
openBarrel(String input,
String className)
Open barrel.
|
static Document |
openDocument(String location,
long uid,
String fileCharset,
boolean lowercase,
boolean phonetics,
HTMLField.Diacritics diacritics)
Open document, can handle html and pdf files.
|
static BarrelReader |
openDocumentOrBarrelReader(String input,
boolean directory,
String className,
long uid)
Open barrel or document in given location for reading.
|
static void |
printL(File a,
int indentation)
Print the name of given
File
to stdout with given indentation. |
static void |
printL(String a,
int indentation)
Print the given String to stdout with given indentation.
|
public static Comparator<File> fileComp
public static boolean getUserApproval()
public static long getUID(String filename, Tanker tanker)
filename
- name of the file in which the document is storedtanker
- tanker to which the document will be appended, and thus
the new identificator must be unused in the tankerpublic static void printL(File a, int indentation)
File
to stdout with given indentation.a
- the File
to be printedindentation
- the wanted indentation levelpublic static void printL(String a, int indentation)
a
- the String to be printedindentation
- the wanted indentation levelpublic static BarrelReader openDocumentOrBarrelReader(String input, boolean directory, String className, long uid)
input
- path to the inputdirectory
- sign if the input is directory or regular fileclassName
- class to be used to read the barreluid
- identifier to be set to documentBarrelReader
instance,
or null if the file type is unknown or
if the construction of the barrel from class className failspublic static Barrel openBarrel(String input, String className)
input
- path to the inputclassName
- class to be used to read the barrelBarrel
instance, or
null if the construction of the barrel from class className failspublic static Document openDocument(String location, long uid, String fileCharset, boolean lowercase, boolean phonetics, HTMLField.Diacritics diacritics)
location
- path to the file with the documentuid
- identifier to be set to documentfileCharset
- charecter set to be used to read the documentlowercase
- sign if lowercase filter should be used to process the filephonetics
- sign if phonetics filter should be used to process the filediacritics
- the diacritics to be used to process the fileDocument
instance,
or null if the file type is unknownpublic static int getLastBarrelFromStateFile(String index)
index
- directory where the index is storedCopyright © 2016 Egothor. All Rights Reserved.