📄 scanbianma.java
字号:
package net.aetherial.gis.test.tools.scanBianma;
import net.aetherial.gis.jiaotongbu.output.number.ReadNumber;
import net.aetherial.gis.jiaotongbu.output.number.NameNumber;
import java.io.File;
import net.aetherial.gis.surface.CreateFile;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ScanBianma {
private String inputPath = "";
private String outputPath = "";
String[] shiShunxu = {
"亳州市",
"六安市",
"合肥市",
"安庆市",
"宣城市",
"宿州市",
"巢湖市",
"池州市",
"淮北市",
"淮南市",
"滁州市",
"芜湖市",
"蚌埠市",
"铜陵市",
"阜阳市",
"马鞍山市",
"黄山市"
};
public ScanBianma() {
new ReadNumber();
}
private String createShi() {
String n = "";
File[] shis = this.getShiFiles();
File[] xians = null;
NameNumber xian = null;
for (int i = 0; shis != null && i < shis.length; i++) {
if (isRightFile(shis[i])) {
// n += "\r\n";
xians = shis[i].listFiles();
for (int j = 0; j < xians.length; j++) {
if (isRightFile(xians[j])) {
xian = (ReadNumber.anhui.getChild(shis[i].getName())).getChild(xians[j].getName());
// n += getARecord(shis[i], xians[j]) + "\r\n\r\n";
if (xian != null) {
n += shis[i].getName() + "\t" + xians[j].getName() +"\t" + xian.getNumber() + "\r\n";
}else{
n += shis[i].getName() + "\t" + xians[j].getName() + "\r\n";
}
}
}
// this.createFile(new File(getSplash(outputPath) + shis[i].getName() +
// "_" + this.fileAddname + ".bat"),
// n);
}
}
return n;
}
public void scanAllAnhui() {
String str = "";
NameNumber shinn = null;
NameNumber[] xians = null;
// NameNumber[] shis = ReadNumber.anhui.getChildren();
for (int i = 0; i < shiShunxu.length; i++) {
shinn = ReadNumber.anhui.getChild(shiShunxu[i]);
xians = shinn.getChildren();
for (int j = 0; j < xians.length; j++) {
str += shiShunxu[i] + "\t" + xians[j].getName() + "\t" +
xians[j].getNumber() + "\r\n";
}
}
// this.createFile(new File(this.getSplashPath(this.outputPath) + "市县编号.txt"),
// createShi());
this.createFile(new File(this.getSplashPath(this.outputPath) + "市县编号.txt"),
str);
}
private boolean isRightFile(File file) {
if (file.getName().indexOf("汇总") != -1 ||
file.getName().indexOf("svn") != -1) {
return false;
}
else {
return true;
}
}
private File[] getShiFiles() {
File anhuisheng = new File(inputPath);
return anhuisheng.listFiles();
}
private String getSplashPath(String path) {
if (path.endsWith("\\")) {
return path;
}
else if (path.endsWith("/")) {
return path;
}
else {
return path + "\\";
}
}
private void createFile(File file, String content) {
CreateFile cf = new CreateFile(file);
cf.setEncode("GB2312");
cf.memoryToFile(content);
System.out.println(file.getAbsolutePath());
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public void setInputPath(String inputPath) {
this.inputPath = inputPath;
}
public static void main(String args[]) {
ScanBianma sb = new ScanBianma();
sb.setInputPath("E:\\农村公路通达情况调查\\数据\\报省数据\\村村通数据\\安徽省");
sb.setOutputPath("E:\\test\\10");
// sb.scanAllAnhui();
sb.scanAllAnhui();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -