indexfiles.java

来自「反ajax原代码」· Java 代码 · 共 85 行

JAVA
85
字号
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   IndexFiles.java

package com.laoer.bbscs.lucene;

import java.io.*;
import java.util.Date;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;

// Referenced classes of package com.laoer.bbscs.lucene:
//            HTMLDocument

class IndexFiles
{

    static Class class$com$laoer$bbscs$lucene$IndexFiles; /* synthetic field */

    IndexFiles()
    {
    }

    public static void main(String args[])
        throws IOException
    {
        String usage = "java " + (class$com$laoer$bbscs$lucene$IndexFiles != null ? class$com$laoer$bbscs$lucene$IndexFiles : (class$com$laoer$bbscs$lucene$IndexFiles = class$("com.laoer.bbscs.lucene.IndexFiles"))) + " <root_directory>";
        if(args.length == 0)
        {
            System.err.println("Usage: " + usage);
            System.exit(1);
        }
        Date start = new Date();
        try
        {
            IndexWriter writer = new IndexWriter("index", new StandardAnalyzer(), true);
            indexDocs(writer, new File(args[0]));
            writer.optimize();
            writer.close();
            Date end = new Date();
            System.out.print(end.getTime() - start.getTime());
            System.out.println(" total milliseconds");
        }
        catch(IOException e)
        {
            System.out.println(" caught a " + e.getClass() + "\n with message: " + e.getMessage());
        }
    }

    public static void indexDocs(IndexWriter writer, File file)
        throws IOException
    {
        System.out.println(file.canRead());
        if(file.canRead())
            if(file.isDirectory())
            {
                String files[] = file.list();
                if(files != null)
                {
                    for(int i = 0; i < files.length; i++)
                        indexDocs(writer, new File(file, files[i]));

                }
            } else
            {
                System.out.println("adding " + file);
                try
                {
                    writer.addDocument(HTMLDocument.Document(file));
                }
                catch(InterruptedException ex) { }
                catch(IOException ex) { }
            }
    }

    static Class class$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw new NoClassDefFoundError(x1.getMessage());
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?