Expectit Expect 工具开源项目

我要开发同款
匿名用户2014年03月24日
25阅读
开发技术Java
所属分类程序开发、常用工具包
授权协议Apache

作品详情

Expectit-是纯Java1.6+实现的Expect工具。简单易用和可扩展,全新编写无需依赖第三方库,使用管道和非堵塞API基于NIO实现。

Maven:

<dependency>    <groupId>net.sf.expectit</groupId>    <artifactId>expectit-core</artifactId>    <version>0.3.0</version></dependency>

使用方法:

// the stream from where you read your input dataInputStream inputStream = ...;// the stream to where you send commandsOutputStream outputStream = ...;Expect expect = new ExpectBuilder()    .withInputs(inputStream)    .withOutput(outputStream)    .build();expect.sendLine("command").expect(contains("string"));Result result = expect.expect(regexp("(.*)--?--(.*)"));// accessing the matching groupString group = result.group(2);
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论