|
|
package com.yohobuy.ufo;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by li.ma on 2019/1/14.
|
|
|
*/
|
|
|
public class Test1 {
|
|
|
// 搜索查询的数据,抽取商品编码
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
String fileName = "C:\\Users\\li.ma\\Desktop\\result.json";
|
|
|
|
|
|
BufferedReader stream = new BufferedReader(new FileReader(fileName));
|
|
|
List<Integer> idList = new ArrayList<>();
|
|
|
while (stream.read()!=-1) {
|
|
|
|
|
|
String line = stream.readLine();
|
|
|
|
|
|
|
|
|
|
|
|
if (null != line && line.contains("\"id\":")) {
|
|
|
int i = line.lastIndexOf("\"id\":");
|
|
|
|
|
|
idList.add(Integer.valueOf(line.substring(i + 5)));
|
|
|
}
|
|
|
}
|
|
|
System.out.println(idList);
|
|
|
}
|
|
|
} |
...
|
...
|
|