src/org/nutz/lang/Streams.java
public static int eachLine(Reader r, Each<String> callback) {
        if (null == callback || null == r)
            return 0;
        BufferedReader br = null;
        try {
            br = Streams.buffr(r);
            String line;
            int index = 0;
            while (null != (line = br.readLine())) {
                try {
                    callback.invoke(index++, line, -1);
                }
                catch (ExitLoop e) {
                    break;
                }
                catch (ContinueLoop e) {
                    continue;
                }
            }
            return index;
        }
        catch (IOException e2) {
            throw Lang.wrapThrow(e2);
        }
        finally {
            Streams.safeClose(br);
        }
    }
public static int eachLine(Reader r, Each<String> callback) {
        if (null == callback || null == r)
            return 0;
        BufferedReader br = null;
        try {
            br = Streams.buffr(r);
            String line;
            int index = 0;
            while (null != (line = br.readLine())) {
                try {
                    callback.invoke(index++, line, -1);
                }
                catch (ExitLoop e) {
                    break;
                }
                catch (ContinueLoop e) {
                    continue;
                }
            }
            return index;
        }
        catch (IOException e2) {
            throw Lang.wrapThrow(e2);
        }
        finally {
            Streams.safeClose(br);
        }
    }
对一个文本输入流迭代每一行，并将其关闭

@param r
文本输入流
@param callback
回调
@return 迭代的行数