org.kohsuke.stapler.framework.io.ByteBuffer.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.kohsuke.stapler.framework.io.ByteBuffer.<init>()方法的一些代码示例,展示了ByteBuffer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.<init>()方法的具体详情如下:
包路径:org.kohsuke.stapler.framework.io.ByteBuffer
类名称:ByteBuffer
方法名:<init>

ByteBuffer.<init>介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskAction context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
    new StreamTaskListener(log),
    new AnnotatedLargeText<TaskAction>(log,Charset.defaultCharset(),false,context)
  );
}

代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder

@Nonnull
public AnnotatedLargeText<FolderComputation<I>> getEventsText() {
  File eventsFile = getEventsFile();
  if (eventsFile.length() <= 0) {
    ByteBuffer buffer = new ByteBuffer();
    try {
      buffer.write(
          String.format("No events as of %tc, waiting for events...%n", new Date())
              .getBytes(Charsets.UTF_8)
      );
      return new AnnotatedLargeText<FolderComputation<I>>(buffer, Charsets.UTF_8, false, this);
    } catch (IOException e) {
      // ignore and fall through
    }
  }
  return new AnnotatedLargeText<FolderComputation<I>>(eventsFile, Charsets.UTF_8, false, this);
}

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Nonnull
public AnnotatedLargeText<FolderComputation<I>> getEventsText() {
  File eventsFile = getEventsFile();
  if (eventsFile.length() <= 0) {
    ByteBuffer buffer = new ByteBuffer();
    try {
      buffer.write(
          String.format("No events as of %tc, waiting for events...%n", new Date())
              .getBytes(Charsets.UTF_8)
      );
      return new AnnotatedLargeText<FolderComputation<I>>(buffer, Charsets.UTF_8, false, this);
    } catch (IOException e) {
      // ignore and fall through
    }
  }
  return new AnnotatedLargeText<FolderComputation<I>>(eventsFile, Charsets.UTF_8, false, this);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskThread context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
    new StreamTaskListener(log),
    new AnnotatedLargeText<TaskThread>(log,Charset.defaultCharset(),false,context)
  );
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskAction context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
    new StreamTaskListener(log),
    new AnnotatedLargeText<TaskAction>(log,Charset.defaultCharset(),false,context)
  );
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskThread context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
    new StreamTaskListener(log),
    new AnnotatedLargeText<TaskThread>(log,Charset.defaultCharset(),false,context)
  );
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskThread context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
      new StreamTaskListener(log),
      new AnnotatedLargeText<TaskThread>(log, Charset.defaultCharset(), false, context));
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Creates one that's backed by memory.
 */
public static ListenerAndText forMemory(TaskThread context) {
  // StringWriter is synchronized
  ByteBuffer log = new ByteBuffer();
  return new ListenerAndText(
    new StreamTaskListener(log),
    new AnnotatedLargeText<TaskThread>(log,Charset.defaultCharset(),false,context)
  );
}

代码示例来源:origin: stapler/stapler

String tail(String text, long start) throws IOException {
  LargeText t;
  try (ByteBuffer bb = new ByteBuffer()) {
    bb.write(text.getBytes(), 0, text.length());
    t = new LargeText(bb, true);
  }
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  assertEquals(text.length(), t.writeLogTo(start, baos));
  return baos.toString();
}

代码示例来源:origin: org.jvnet.hudson.plugins/clearcase

/**
 * Displays "cleartool -version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch().cmds(getCleartoolExe(), "-version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

/**
 * Displays "cvs --version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp)
  throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
      .cmds(getCvsExeOrDefault(), "--version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

代码示例来源:origin: org.hudsonci.plugins/cvs

/**
 * Displays "cvs --version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp)
  throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
      .cmds(getCvsExeOrDefault(), "--version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

相关文章