本文整理汇总了Java中org.apache.tools.ant.input.MultipleChoiceInputRequest类的典型用法代码示例。如果您正苦于以下问题:Java MultipleChoiceInputRequest类的具体用法?Java MultipleChoiceInputRequest怎么用?Java MultipleChoiceInputRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultipleChoiceInputRequest类属于org.apache.tools.ant.input包,在下文中一共展示了MultipleChoiceInputRequest类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleInput
import org.apache.tools.ant.input.MultipleChoiceInputRequest; //导入依赖的package包/类
public void handleInput(InputRequest request) throws BuildException {
final String prompt = request.getPrompt();
if (prompt == null) {
throw new BuildException("Prompt is null");
}
final SegmentedOutputStream err = IdeaAntLogger2.ourErr;
if (err == null) {
throw new BuildException("Selected InputHandler should be used by Intellij IDEA");
}
final PacketWriter packet = PacketFactory.ourInstance.createPacket(IdeaAntLogger2.INPUT_REQUEST);
packet.appendLimitedString(prompt);
packet.appendLimitedString(request.getDefaultValue());
if (request instanceof MultipleChoiceInputRequest) {
Vector choices = ((MultipleChoiceInputRequest)request).getChoices();
if (choices != null && choices.size() > 0) {
int count = choices.size();
packet.appendLong(count);
for (int i = 0; i < count; i++) {
packet.appendLimitedString((String)choices.elementAt(i));
}
}
else {
packet.appendLong(0);
}
}
else {
packet.appendLong(0);
}
packet.sendThrough(err);
try {
final byte[] replayLength = readBytes(4);
final int length = ((int)replayLength[0] << 24) | ((int)replayLength[1] << 16) | ((int)replayLength[2] << 8) | replayLength[3];
final byte[] replay = readBytes(length);
final String input = new String(replay);
request.setInput(input);
if (!request.isInputValid()) {
throw new BuildException("Invalid input: " + input);
}
}
catch (IOException e) {
throw new BuildException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:IdeaInputHandler.java
注:本文中的org.apache.tools.ant.input.MultipleChoiceInputRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论