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

📄 miffiletokenizer.java

📁 .mif .mid file read and write
💻 JAVA
字号:
/*
 *    GeoTools - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2005-2006, GeoTools Project Managment Committee (PMC)
 * 
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.data.mif;

import java.io.BufferedReader;
import java.io.IOException;


/**
 * Simple tokenizer class for BufferedReaders
 *
 * @author Luca S. Percich, AMA-MI
 * @source $URL: http://svn.geotools.org/trunk/modules/unsupported/mif/src/main/java/org/geotools/data/mif/MIFFileTokenizer.java $
 * @version $Id: MIFFileTokenizer.java 22266 2006-10-19 11:30:55Z acuster $
 */
public class MIFFileTokenizer extends MIFStringTokenizer {
    private BufferedReader reader = null;
    private int lineNumber = 0;

    /**
     * Builds a tokenizer for a BufferedReader
     *
     * @param aReader
     */
    public MIFFileTokenizer(BufferedReader aReader) {
        super();
        reader = aReader;
    }

    /**
     * Closes the associated reader.
     */
    public void close() {
        try {
            reader.close();
            reader = null;
        } catch (Exception e) {
        }
    }

    /**
     * Stores the next non-null line from file buffer in the line buffer
     *
     * @return True if a non-null string was read, false if EOF or error
     */
    public boolean readLine() {
        String buffer = "";

        do {
            try {
                buffer = reader.readLine();

                if (buffer == null) {
                    return readLine(""); //EOF
                }
            } catch (IOException e) {
                return readLine("");
            }

            lineNumber++;
            buffer = buffer.trim();
        } while (buffer.length() == 0);

        return readLine(buffer);
    }

    /**
     * Returns the current line number
     *
     */
    public int getLineNumber() {
        return lineNumber;
    }
}

⌨️ 快捷键说明

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