📄 zj1filereader.java
字号:
import java.io.*;
import java.awt.geom.Point2D;
import java.util.ArrayList;
public class Zj1FileReader
{
private ArrayList annotations = null;
public Zj1FileReader()
{
annotations = new ArrayList();
}
public ArrayList getAnnoData()
{
return annotations;
}
public void readData(String zj1File)
{
try
{
BufferedReader in = new BufferedReader(new FileReader(zj1File));
String s;
String s1, s2;
double x,y;
int len, i;
while((s = in.readLine()) != null)
{
ZbaAnnotation anno = new ZbaAnnotation();
s= s.trim();
i = s.indexOf(32);
if(i == -1) break;
s2 = s.substring(i);
s1 = s.substring(0,i);
anno.setGrade(Short.parseShort(s1));
s2 = s2.trim();
i = s2.indexOf(32);
s1 = s2.substring(0,i);
s2 = s2.substring(i);
x = Double.parseDouble(s1);
s2 = s2.trim();
i = s2.indexOf(32);
s1 = s2.substring(0,i);
s2 = s2.substring(i);
y = Double.parseDouble(s1);
anno.setLocation(new Point2D.Double(x,y));
s2 = s2.trim();
anno.setAnno(s2);
annotations.add(anno);
}
in.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -