📄 读取mapinfo格式的java源码.txt
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -