⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outputpipe.java

📁 MoMEUnit是一个单元测试的J2ME的应用程序xUnit架构实例。这是来自JUnit框架
💻 JAVA
字号:
package org.momeunit.ant.core;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.io.PipedInputStream;import java.io.PipedOutputStream;/** * Abstract class that every output processing pipe should extend. Provides base * functionality. Like setting input stream, requesting pipe etc. *  * @author Sergio Morozov * @version 1.1.2 */public abstract class OutputPipe implements Runnable{  private InputStream in = null;  private OutputStream out = null;  /**   * Initializes OutputPipe with given {@link InputStream}.   *    * @param pipeIn   *          the {@link InputStream} to set.   * @since 1.1   */  public OutputPipe(InputStream pipeIn)  {    super();    this.in = pipeIn;  }  /**   * Starts processing input and sending it to a pipe if requested.   *    * @since 1.1   */  public void start()  {    if (this.getInputStream() != null) new Thread(this).start();  }  /**   * Returns the {@link OutputStream} of the pipe.   *    * @return the {@link OutputStream} of the pipe.   * @since 1.1   */  protected OutputStream getOutpuStream()  {    return this.out;  }  /**   * Returns requested {@link InputStream} of pipe.   *    * @return the requested {@link InputStream} of pipe.   * @throws IOException   *           if an error occurs while creating pipe.   * @since 1.1   */  public InputStream getPipeOutput() throws IOException  {    PipedInputStream res = new PipedInputStream();    this.out = new PipedOutputStream(res);    return res;  }  /**   * Returns input of this OutputPipe.   *    * @return the input of this OutputPipe.   * @since 1.1   */  public InputStream getInputStream()  {    return this.in;  }  /**   * Sets input of this OutputPipe.   *    * @param in   *          input of this OutputPipe.   * @since 1.1   */  public void setInputStream(InputStream in)  {    this.in = in;  }  /*   * @see java.lang.Runnable#run()   */  public void run()  {}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -