示例#1
0
文件: LogTools.java 项目: visik7/jpod
 public static void reconfigure(ClassLoader classloader, String resource) {
   InputStream is = null;
   try {
     is = classloader.getResourceAsStream(resource);
     if (is != null) {
       LogManager.getLogManager().readConfiguration(is);
     }
   } catch (Exception e) {
     //
   } finally {
     StreamTools.close(is);
   }
   // hack for java.util.logging reconfiguration bug, force level init
   try {
     is = classloader.getResourceAsStream(resource);
     if (is != null) {
       Properties p = new Properties();
       p.load(is);
       for (Map.Entry entry : p.entrySet()) {
         String key = (String) entry.getKey();
         if (key.endsWith(".level")) {
           String logger = key.substring(0, key.length() - 6);
           // just touch logger
           Logger.getLogger(logger);
         }
       }
     }
   } catch (Exception e) {
     //
   } finally {
     StreamTools.close(is);
   }
 }
示例#2
0
文件: PDFont.java 项目: visik7/jpod
 public void dumpFontFile(File file) {
   PDFontDescriptorEmbedded fd = (PDFontDescriptorEmbedded) getFontDescriptor();
   if (fd == null) {
     return;
   }
   byte[] data = fd.getFontFile();
   if (data == null) {
     data = fd.getFontFile2();
   }
   if (data == null) {
     data = fd.getFontFile3();
   }
   if (data == null) {
     return;
   }
   FileOutputStream os = null;
   try {
     os = new FileOutputStream(file);
     os.write(data);
   } catch (Exception e) {
     // ignore
   } finally {
     StreamTools.close(os);
   }
 }