?? grepinputstream.java
字號:
package com.javapatterns.decorator.greps;
import java.io.FilterInputStream;
import java.io.DataInputStream;
import java.io.IOException;
public class GrepInputStream extends FilterInputStream
{
String substring;
DataInputStream in;
public GrepInputStream(DataInputStream in, String substring)
{
super(in);
this.in = in;
this.substring = substring;
}
// This is the filter: read lines from the DataInputStream,
// but only return the lines that contain the substring.
// When the DataInputStream returns null, we return null.
public final String readLine() throws IOException
{
String line;
do
{
line = in.readLine();
}
while ((line != null) && line.indexOf(substring) == -1);
return line;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -