当前位置: 首页>>代码示例>>Java>>正文


Java PacketWriter.appendLimitedString方法代码示例

本文整理汇总了Java中com.intellij.rt.execution.junit.segments.PacketWriter.appendLimitedString方法的典型用法代码示例。如果您正苦于以下问题:Java PacketWriter.appendLimitedString方法的具体用法?Java PacketWriter.appendLimitedString怎么用?Java PacketWriter.appendLimitedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.rt.execution.junit.segments.PacketWriter的用法示例。


在下文中一共展示了PacketWriter.appendLimitedString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: peformSendMessage

import com.intellij.rt.execution.junit.segments.PacketWriter; //导入方法依赖的package包/类
protected void peformSendMessage(char id, int priority, Throwable throwable) {
  if (throwable != null) {
    PacketWriter packet = createPacket(id, priority);
    StringWriter stackTrace = new StringWriter();
    throwable.printStackTrace(new PrintWriter(stackTrace));
    packet.appendChar(EXCEPTION_CONTENT);
    packet.appendLimitedString(stackTrace.toString());
    send(packet);
  } else {
    peformSendMessage(id, priority, "");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IdeaAntLogger2.java

示例2: handleInput

import com.intellij.rt.execution.junit.segments.PacketWriter; //导入方法依赖的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


注:本文中的com.intellij.rt.execution.junit.segments.PacketWriter.appendLimitedString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。