读取mapinfo格式的java源码.txt
来自「读取MapInfo格式的Java源码」· 文本 代码 · 共 91 行
TXT
91 行
import java.io.*;
import java.util.StringTokenizer;
// Referenced classes of MIFFileException
public class MIFFile
implements Serializable
{
class MIFHeader
implements Serializable
{
public int getVersion()
{
return version;
}
public String getCharset()
{
return charset;
}
public int getColumnCount()
{
return columnCount;
}
public char getDimilitator()
{
return delim;
}
int version;
String charset;
int columnCount;
char delim;
public MIFHeader(BufferedReader info)
throws IOException
{
super();
version = -1;
charset = "undefined";
columnCount = 0;
delim = '\t';
String line;
while((line = info.readLine()) != null && !line.equalsIgnoreCase("DATA"))
{
StringTokenizer st = new StringTokenizer(line);
String item = st.nextToken();
if(item.equalsIgnoreCase("version"))
version = (new Integer(st.nextToken())).intValue();
if(item.equalsIgnoreCase("charset"))
charset = st.nextToken();
if(item.equalsIgnoreCase("columns"))
columnCount = (new Integer(st.nextToken())).intValue();
if(item.equalsIgnoreCase("delimiter"))
delim = st.nextToken().charAt(1);
}
}
}
public MIFFile(String filename)
throws IOException, MIFFileException
{
super();
InputStream miffile = new FileInputStream(filename);
init(miffile);
}
public synchronized void init(InputStream file)
throws IOException, MIFFileException
{
BufferedReader info = new BufferedReader(new InputStreamReader(file));
head = new MIFHeader(info);
}
public static void main(String args[])
throws IOException, MIFFileException
{
MIFFile mif = new MIFFile("c:/users/default/nethtemp.mif");
}
private static final int DEF_VERSION = 300;
MIFHeader head;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?