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

📄 output.java

📁 KWIC系统 采用管道/过滤器风格实现
💻 JAVA
字号:
//package kwic.pf;



import java.io.IOException;
import javax.swing.*;
import javax.swing.text.*;

/* Output prints the data from its input pipe on the standard output.*/


public class Output extends Filter
{
	private JTextArea resultPane;
	private String filterType;

    public Output(Pipe input, JTextArea resultPanel,String filterType)
    {
         super(input, null);
         resultPane = resultPanel;
         this.filterType=filterType;
    }

/* This method writes the data from the input pipe on the standard output. */

  protected void transform()
  {
    try
    {
      int c = input_.read();
      while(c != -1)
      {
         System.out.print((char) c);
         resultPane.append(""+(char)c);
         c = input_.read();
      }
      if(filterType.compareTo("a2")==0 ||filterType.compareTo("a3")==0 )
            System.out.println();
    }
    catch(IOException exc){
      exc.printStackTrace();
      System.err.println("KWIC Error: Broken pipe");
      System.exit(1);
    }
  }
}

⌨️ 快捷键说明

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