Package com.google.code.ftspc.lector.parsers

Examples of com.google.code.ftspc.lector.parsers.Parser


            }
        }
    }

    private void indexDocs_extracting_and_adding(String filePath) {
        Parser selectedParser;
        String fileName = filePath.substring(filePath.lastIndexOf(Vars.fileSeparator)+1);
        File someFileForTypeRecognizing = new File(filePath);
        String hash;
        String newFilePath;

        Vars.totalSizeOfProcessedFiles += someFileForTypeRecognizing.length();

        try {
            String type = Vars.tika.detect(someFileForTypeRecognizing);
            if (Vars.parsersFromXML.get(type) != null) {
                selectedParser = (Parser) (Class.forName(
                        Vars.parsersFromXML.get(type).
                        get("class").toString())).newInstance();
                Vars.current_run_indexes++;
                if (selectedParser.getClass().getName().indexOf("ZIP") < 1) {
                    hash = (new Date()).getTime() + Long.toHexString(random.nextLong())
                            + Long.toHexString(random.nextLong());
                    MoveDir moveDir = new MoveDir();
                    newFilePath = Vars.pathToDayDir + "/" + hash;
                    moveDir.copyFile(someFileForTypeRecognizing, new File(newFilePath));
                    someFileForTypeRecognizing.delete();
                    filePath = newFilePath;
                }

                selectedParser.start_th(filePath, fileName);
                type = null;
            } else {
                System.out.println("UNKNOWN TYPE " + type + " " + filePath);
            }
        } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.google.code.ftspc.lector.parsers.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.