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

📄 filefilter.java

📁 正在学习Java的人或许能从中得到自己想要的东西
💻 JAVA
字号:
import java.io.*;
public class FileFilter extends FilterInputStream {

    static int MAX=1000;

    public FileFilter(InputStream f) {
        super(f);
    }

    //------------------------
    public String readLine() {
        String s;
        int length = 0;

        byte b[] = new byte[MAX];
        try {
            length = super.read(b);
            s = new String(b, 0, length);
        } catch (IOException e) {
            s = "";
        }

        StringBuffer buf = new StringBuffer(s);
        boolean punctFound = true;

        for (int i=0; i < length; i++) {
            char ch = buf.charAt (i);
            if (punctFound && (ch != ' ') ) {
                ch = Character.toUpperCase (ch);
                buf.setCharAt (i, ch);
                punctFound = false;
            }
            if (ch == '.')
                punctFound = true;
        }
        s = buf.toString ();
        return s;
    }
}

⌨️ 快捷键说明

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