Here you can find the source of saveIndex(File root_, Hashtable index)
Parameter | Description |
---|---|
root_ | The file where the index is stored in. |
index | The indextable. |
public static void saveIndex(File root_, Hashtable index) throws IOException
//package com.java2s; /*//from ww w .ja va2 s. c om This file is part of WOW! based on AHA! (Adaptive Hypermedia for All) which is free software (GNU General Public License) developed by Paul De Bra - Eindhoven University of Technology and University WOW! is also open source software; */ import java.io.*; import java.util.Enumeration; import java.util.Hashtable; public class Main { /** * Saves an index (Hashtable) to a file. * @param root_ The file where the index is stored in. * @param index The indextable. * @exception IOException If an internal error prevents the file * from being written. */ public static void saveIndex(File root_, String name, Hashtable index) throws IOException { File indexfile = new File(root_, name); PrintWriter out = new PrintWriter(new FileWriter(indexfile)); Enumeration keys = index.keys(); String key = null; while (keys.hasMoreElements()) { key = (String) keys.nextElement(); out.println(key); out.println((Long) index.get(key)); } out.close(); } /** * Saves an index (Hashtable) to a file. * @param root_ The file where the index is stored in. * @param index The indextable. * @exception IOException If an internal error prevents the file * from being written. */ public static void saveIndex(File root_, Hashtable index) throws IOException { saveIndex(root_, "index", index); } }