Ejemplo n.º 1
0
 public void run() {
   try {
     mainLoop();
   } catch (Throwable t) {
     StringUtil.printException(t);
   }
 }
Ejemplo n.º 2
0
 /** GoGuiThumbnailer main function. */
 public static void main(String[] args) {
   try {
     String options[] = {
       // "check-expire:", // experimental; needs more testing
       "config:",
       // "expire:", // experimental; needs more testing
       "help",
       "scale",
       "size:",
       "verbose",
       "version"
     };
     Options opt = Options.parse(args, options);
     if (opt.contains("help")) {
       printUsage(System.out);
       return;
     }
     if (opt.contains("version")) {
       System.out.println("GoGuiThumbnailer " + Version.get());
       return;
     }
     /*
     if (opt.contains("expire"))
     {
         int seconds = opt.getInteger("expire", 0, 0);
         ThumbnailUtil.expire(seconds, false);
         return;
     }
     if (opt.contains("check-expire"))
     {
         int seconds = opt.getInteger("expire", 0, 0);
         ThumbnailUtil.expire(seconds, true);
         return;
     } */
     boolean verbose = opt.contains("verbose");
     boolean scale = opt.contains("scale");
     ArrayList<String> arguments = opt.getArguments();
     if (arguments.isEmpty() || arguments.size() > 2) {
       printUsage(System.err);
       System.exit(1);
     }
     File input = new File(arguments.get(0));
     File output = null;
     if (arguments.size() == 2) output = new File(arguments.get(1));
     int size = opt.getInteger("size", 128, 1);
     ThumbnailCreator thumbnailCreator = new ThumbnailCreator(verbose);
     try {
       thumbnailCreator.create(input, output, size, scale);
     } catch (ThumbnailCreator.Error e) {
       System.err.println(e.getMessage());
       System.exit(1);
     }
   } catch (Throwable t) {
     StringUtil.printException(t);
     System.exit(1);
   }
 }
Ejemplo n.º 3
0
 public void run() {
   try {
     char[] buffer = new char[4096];
     while (true) {
       int n;
       try {
         n = m_in.read(buffer);
       } catch (IOException e) {
         return;
       }
       if (n <= 0) return;
       String text = new String(buffer, 0, n);
       if (m_callback != null) m_callback.receivedStdErr(text);
       if (m_log) logError(text);
     }
   } catch (Throwable t) {
     StringUtil.printException(t);
   }
 }