本文整理了Java中org.kohsuke.stapler.framework.io.ByteBuffer
类的一些代码示例,展示了ByteBuffer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer
类的具体详情如下:
包路径:org.kohsuke.stapler.framework.io.ByteBuffer
类名称:ByteBuffer
[英]ByteArrayOutputStream re-implementation.
This version allows one to read while writing is in progress.
[中]ByteArrayOutputStream重新实现。
这个版本允许一个人在写作过程中阅读。
代码示例来源: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.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.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: org.kohsuke.stapler/stapler
public synchronized void write(int b) throws IOException {
ensureCapacity(1);
buf[size++] = (byte)b;
}
代码示例来源:origin: org.kohsuke.stapler/stapler
public long length() {
return memory.length();
}
代码示例来源:origin: org.hudsonci.stapler/stapler-core
public BufferSession(ByteBuffer buf) {
this.in = buf.newInputStream();
}
代码示例来源: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: 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.hudsonci.stapler/stapler-core
public synchronized void write(int b) throws IOException {
ensureCapacity(1);
buf[size++] = (byte)b;
}
代码示例来源:origin: org.hudsonci.stapler/stapler-core
public long length() {
return memory.length();
}
代码示例来源:origin: org.kohsuke.stapler/stapler
public BufferSession(ByteBuffer buf) {
this.in = buf.newInputStream();
}
代码示例来源: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.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);
}
}
代码示例来源: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: stapler/stapler
public synchronized void write(int b) throws IOException {
ensureCapacity(1);
buf[size++] = (byte)b;
}
代码示例来源:origin: stapler/stapler
public long length() {
return memory.length();
}
代码示例来源:origin: stapler/stapler
public BufferSession(ByteBuffer buf) {
this.in = buf.newInputStream();
}
代码示例来源: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.kohsuke.stapler/stapler
public synchronized void write(byte b[], int off, int len) throws IOException {
ensureCapacity(len);
System.arraycopy(b,off,buf,size,len);
size+=len;
}
代码示例来源: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)
);
}
内容来源于网络,如有侵权,请联系作者删除!