📄 makedata.java
字号:
package net.xdevelop.mobile.analize;
import net.xdevelop.mobile.*;
import net.xdevelop.util.*;
/**
* <p>Title: 手机所属地查询</p>
* <p>Description: 自动提交查询表单搜集网上数据, 根据收集数据提供查询API</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: www.xdevelop.net</p>
* @author starboy
* @version 1.0
*/
import java.io.*;
import net.xdevelop.mobile.*;
public class MakeData {
public MakeData() {
}
public static String data[] = new String[100000];
public static void load() {
try {
File file = new File("d:/mobile_nn.txt");
FileReader fr = new FileReader(file);
BufferedReader in = new BufferedReader(fr);
String line = "";
String no;
String mobile;
String province;
String city;
String card;
int begin;
int end;
while (true) {
try {
line = in.readLine();
if (line == null)
break;
begin = line.indexOf(" ", 0);
if(line.length() < 9 ) {
data[Integer.parseInt(line.trim())] = "";
continue;
}
else {
no = line.substring(0, begin);
data[Integer.parseInt(no)] = line.substring(begin + 1);
//System.out.println(data[Integer.parseInt(no)]);
}
}
catch(Exception e) {
System.out.println("Error occured in load data:" + line );
}
}
}catch (Exception e) {
System.out.println(e.getMessage());
}
}
public static void main(String[] args) {
/*
load();
MobileData md = new MobileData();
System.out.println("load complete");
String line;
String province;
String city;
String card;
int begin;
int end;
for (int i = 0; i < 100000; i++) {
line = data[i];
if (line == null || line.equals("")) {
md.province[i] = "";
md.city[i] = "";
md.card[i] = "";
}
else {
begin = line.indexOf(" ");
end = line.indexOf(" ", begin + 1);
province = line.substring(0, begin);
city = line.substring(begin+1, end);
card = line.substring(end + 1);
md.province[i] = province;
md.city[i] = city;
md.card[i] = card;
}
//System.out.println(MobileData.province[i] + " " + MobileData.city[i] + " " + MobileData.card[i]);
}
try {
md.province[100000] = "";
md.city[100000] = "";
md.card[100000] = "";
byte[] obj = ObjectUtil.ObjectToByteArray(md);
File file = new File("D:/md.dat");
OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
out.write(obj);
out.flush();
out.close();
}catch (Exception e) {
System.out.println("error occured when convert");
}
//*/
//* 载入
try {
File file = new File("D:/md.dat");
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
byte[] obj = new byte[3581541];
in.read(obj);
MobileData md2 = (MobileData)ObjectUtil.ByteArrayToObject(obj);
for (int i = 0; i < 99; i++) {
System.out.print(md2.province[i]);
System.out.print(md2.city[i]);
System.out.println(md2.card[i]);
}
}
catch (Exception e) {
}
//*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -