promptfactory.java

来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· Java 代码 · 共 32 行

JAVA
32
字号
package org.codehaus.groovy.sandbox.ui;

import java.io.InputStream;
import java.io.PrintStream;

/**
 * Factory to build a command line prompt.  Should build the most featureful
 * prompt available.
 * <p/>
 * Currently readline prompt will be looked up dynamically, and defaults to
 * normal System.in prompt.
 */
public class PromptFactory
{
    public static Prompt buildPrompt(InputStream in, PrintStream out, PrintStream err)
    {
        try
        {
            return (Prompt) Class.forName("org.codehaus.groovy.sandbox.ui.ReadlinePrompt").newInstance();
        }
        catch (ClassNotFoundException e)
        {
            return new JavaPrompt(in, out, err);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            return new JavaPrompt(in, out, err);
        }
    }
}

⌨️ 快捷键说明

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