示例#1
0
 /**
  * load from specified JarInputStream
  *
  * @param fis Jar Input Stream
  * @param mnemo the name for the text file
  */
 private void addToCache(JarInputStream fis, String mnemo) {
   String text = "";
   byte[] buf = new byte[4096];
   int i = 0;
   try {
     while ((i = fis.read(buf)) != -1) {
       text += new String(buf, 0, i);
     }
   } catch (IOException ignored) {
   }
   helpcache.put(mnemo, text);
 }
示例#2
0
文件: Installer.java 项目: suever/CTP
 private static Hashtable<String, String> getManifestAttributes(Manifest manifest) {
   Hashtable<String, String> h = new Hashtable<String, String>();
   try {
     Attributes attrs = manifest.getMainAttributes();
     Iterator it = attrs.keySet().iterator();
     while (it.hasNext()) {
       String key = it.next().toString();
       h.put(key, attrs.getValue(key));
     }
   } catch (Exception ignore) {
   }
   return h;
 }
示例#3
0
 /**
  * Loads from specified file
  *
  * @param file
  * @param mnemo the name for the text file
  */
 private void addToCache(File file, String mnemo) {
   BufferedInputStream fis;
   try {
     fis = new BufferedInputStream(new FileInputStream(file));
   } catch (FileNotFoundException e) {
     System.out.println("Warning! File '" + file + "' not found!");
     return;
   }
   String text = "";
   byte[] buf = new byte[4096];
   int i = 0;
   try {
     while ((i = fis.read(buf)) != -1) {
       text += new String(buf, 0, i);
     }
     fis.close();
   } catch (IOException ignored) {
   }
   helpcache.put(mnemo, text);
 }