⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tinyvm.java

📁 专业汽车级嵌入式操作系统OSEK的源代码
💻 JAVA
字号:
package js.tinyvm;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStream;import js.common.CLIToolProgressMonitor;import js.common.ToolProgressMonitor;import js.tinyvm.util.TinyVMCommandLineParser;import org.apache.commons.cli.CommandLine;/** * Tiny VM. */public class TinyVM extends TinyVMTool{	private TinyVMCommandLineParser fParser;	   /**    * Main entry point for command line usage.    *     * @param args command line    */   public static void main (String[] args)   {      try      {         TinyVM tinyVM = new TinyVM(new CLIToolProgressMonitor());         tinyVM.start(args);      }      catch (TinyVMException e)      {         System.err.println(e.getMessage());         System.exit(1);      }   }   /**    * Constructor.    */   public TinyVM (ToolProgressMonitor monitor)   {      super(monitor);      fParser = new TinyVMCommandLineParser();   }   /**    * Execute tiny vm.    *     * @param args command line    * @throws TinyVMException    */   public void start (String[] args) throws TinyVMException   {      assert args != null: "Precondition: args != null";      CommandLine commandLine = fParser.parse(args);      // options      boolean verbose = commandLine.hasOption("v");      String classpath = commandLine.getOptionValue("cp");      String output = commandLine.getOptionValue("o");      boolean all = commandLine.hasOption("a");      boolean bigEndian = "be".equalsIgnoreCase(commandLine         .getOptionValue("wo"));      // files      String[] classes = commandLine.getArgs();      ((CLIToolProgressMonitor) getProgressMonitor()).setVerbose(verbose);      OutputStream stream = null;      try      {         stream = output == null            ? (OutputStream) System.out            : (OutputStream) new FileOutputStream(output);         link(classpath, classes, all, stream, bigEndian);      }      catch (FileNotFoundException e)      {         throw new TinyVMException(e.getMessage(), e);      }      finally      {         if (stream instanceof FileOutputStream)         {            try            {               stream.close();            }            catch (IOException e)            {               throw new TinyVMException(e);            }         }      }   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -