• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DefaultInputHandler类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.tools.ant.input.DefaultInputHandler的典型用法代码示例。如果您正苦于以下问题:Java DefaultInputHandler类的具体用法?Java DefaultInputHandler怎么用?Java DefaultInputHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DefaultInputHandler类属于org.apache.tools.ant.input包,在下文中一共展示了DefaultInputHandler类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: prompt

点赞 3

import org.apache.tools.ant.input.DefaultInputHandler; //导入依赖的package包/类
public void prompt(String message) {
	InputRequest ir = new InputRequest("Debugger> ");
	InputHandler ih = new DefaultInputHandler();
	String command = null;
	project.log(StringUtils.LINE_SEP
			+ "-------- Ant Command Line Debugger --------"
			+ StringUtils.LINE_SEP + StringUtils.LINE_SEP);

	// print a friendly message to allow the user to understand why this
	// breakpoint occurred
	project.log(message);
	project.log("");
	// keep accepting inputs, until the user enters the return command
	do {
		ih.handleInput(ir);
		command = ir.getInput();
		commandHandler.handleCommand(command);
		project.log(""); // log a new line
	} while (!"return".equals(command));

	// resume build execution on this
	project.log(StringUtils.LINE_SEP
			+ "--------- Resuming Ant Execution ----------"
			+ StringUtils.LINE_SEP);
}
 

开发者ID:apache,
项目名称:ant-easyant-tasks,
代码行数:26,
代码来源:DebugPrompt.java

示例2: testInputHandler

点赞 2

import org.apache.tools.ant.input.DefaultInputHandler; //导入依赖的package包/类
@Test
public void testInputHandler() {
    InputHandler ih = p.getInputHandler();
    assertNotNull(ih);
    assertTrue(ih instanceof DefaultInputHandler);
    InputHandler pfih = new PropertyFileInputHandler();
    p.setInputHandler(pfih);
    assertSame(pfih, p.getInputHandler());
}
 

开发者ID:apache,
项目名称:ant,
代码行数:10,
代码来源:ProjectTest.java

示例3: Project

点赞 2

import org.apache.tools.ant.input.DefaultInputHandler; //导入依赖的package包/类
/**
 * Create a new Ant project.
 */
public Project() {
    inputHandler = new DefaultInputHandler();
}
 

开发者ID:apache,
项目名称:ant,
代码行数:7,
代码来源:Project.java

示例4: testReleasedInput

点赞 2

import org.apache.tools.ant.input.DefaultInputHandler; //导入依赖的package包/类
@Test
public void testReleasedInput() throws Exception {
    PipedOutputStream out = new PipedOutputStream();
    final PipedInputStream in = new PipedInputStream(out);
    buildRule.getProject().setInputHandler(new DefaultInputHandler() {
        protected InputStream getInputStream() {
            return in;
        }
    });
    buildRule.getProject().setDefaultInputStream(in);

    Java java = new Java();
    java.setProject(buildRule.getProject());
    java.setClassname("org.apache.tools.ant.Main");
    java.setArgs("-version");
    java.setFork(true);
    // note: due to the missing classpath it will fail, but the input stream
    // reader will be read
    java.execute();

    Thread inputThread = new Thread(new Runnable() {
        public void run() {
            Input input = new Input();
            input.setProject(buildRule.getProject());
            input.setAddproperty("input.value");
            input.execute();
        }
    });
    inputThread.start();

    // wait a little bit for the task to wait for input
    Thread.sleep(100);

    // write some stuff in the input stream to be caught by the input task
    out.write("foo\n".getBytes());
    out.flush();
    try {
        out.write("bar\n".getBytes());
        out.flush();
    } catch (IOException x) {
        // "Pipe closed" on XP; ignore?
    }

    inputThread.join(2000);

    assertEquals("foo", buildRule.getProject().getProperty("input.value"));
}
 

开发者ID:apache,
项目名称:ant,
代码行数:48,
代码来源:JavaTest.java

示例5: shouldSetDefaultInputHandler

点赞 2

import org.apache.tools.ant.input.DefaultInputHandler; //导入依赖的package包/类
@Test
public void shouldSetDefaultInputHandler() {
    easyantEngine.addInputHandler(project);
    assertThat(project.getInputHandler(), instanceOf(DefaultInputHandler.class));
}
 

开发者ID:apache,
项目名称:ant-easyant-core,
代码行数:6,
代码来源:EasyAntEngineTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)