* The main class without Ant dependencies.
* This can be used as a standalone jar.
*
+ * @param args
*/
public static void main(String[] args) {
Iterator it;
//File name initialization
- String htmlList = "htmlFileList.js";
+ String htmlList = "htmlFileInfoList.js";
String htmlInfoList = "htmlFileInfoList.js";
String indexName = ".js";
// check if outputdir exists
File tempfile = new File(outputDir);
if (!tempfile.exists()) {
- boolean b = (new File(outputDir)).mkdir();
+ boolean b = tempfile.mkdirs();
if (!b) {
System.out.println(txt_cannot_create_outputdir + " " + outputDir + ".");
return;
}
//end of init
-
// Get the list of all html files but the tocs, covers and indexes
DirList nsiDoc = new DirList(inputDir, "^.*\\." + htmlExtension + "?$", 1);
htmlFiles = nsiDoc.getListFiles();
Date dateEnd = new Date();
long diff = dateEnd.getTime() - dateStart.getTime();
if (diff < 1000)
- System.out.println("Delay = " + diff + " milliseconds");
+ System.out.println("Indexed the contents in " + diff + " milliseconds");
else
- System.out.println("Delay = " + diff / 1000 + " seconds");
+ System.out.println("Indexed the contents in " + diff / 1000 + " seconds");
} else {
System.out.println(txt_wrong_dita_basedir);
}
package com.nexwave.nquindexer;
-import java.io.*;
+import com.nexwave.nsidita.DocFileInfo;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
-import com.nexwave.nsidita.DocFileInfo;
-
/**
* Outputs the js files with:
* - the list of html files and their description
it = list.iterator();
try {
- // open a outputstream, here a file
+ // open an outputStream, here a file. File is replaced rather than appending
OutputStream fOut = new FileOutputStream(fileO);
OutputStream bout = new BufferedOutputStream(fOut);
OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");
/*fl : file list*/
- out.write("//List of files which are indexed.\n");
+ out.write("var doStem = " + doStem + ";\n");
+ out.write("//List of indexed files.\n");
out.write("fl = new Array();\n");
String temp;
while (it.hasNext()) {
i++;
}
- out.write("var doStem = " + doStem + "");
out.flush(); // Don't forget to flush!
out.close();
// System.out.println("the array of html is in " + fileO);
}
it = list.iterator();
try {
- // open a outputstream, here a file
- OutputStream fOut = new FileOutputStream(fileO);
+ // open a outputstream, here a file. The file get appended
+ OutputStream fOut = new FileOutputStream(fileO, true);
// open a buffer output stream
OutputStream bout = new BufferedOutputStream(fOut);
OutputStreamWriter out