changed metamap

This commit is contained in:
snoop 2017-04-26 20:10:33 +09:00
parent 9a5a8f696c
commit 7f6fe40dae
2 changed files with 8 additions and 11 deletions

View File

@ -110,7 +110,7 @@ public class WMICrawlerLinux extends WMICrawlerOS {
continue; continue;
} }
row = new ArrayList<>(); row = new ArrayList<>(Arrays.asList(new String[metaMap.size()]));
String[] datas = line.split(DELIMITER_SPLIT); String[] datas = line.split(DELIMITER_SPLIT);
@ -118,8 +118,8 @@ public class WMICrawlerLinux extends WMICrawlerOS {
tempMap.put(columns.get(indexJ), datas[indexJ]); tempMap.put(columns.get(indexJ), datas[indexJ]);
} }
for(String key : metaMap.keySet()) { for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
row.add(tempMap.get(key)); row.set(info.getValue().intValue(), tempMap.get(info.getKey()));
} }

View File

@ -10,10 +10,7 @@ import com.loafle.overflow.crawler.config.Query;
import com.loafle.overflow.crawler.result.OFResultSet; import com.loafle.overflow.crawler.result.OFResultSet;
import com.loafle.overflow.crawler.result.OFResultSetCol; import com.loafle.overflow.crawler.result.OFResultSetCol;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created by snoop on 2017-04-11. * Created by snoop on 2017-04-11.
@ -62,16 +59,16 @@ public class WMICrawlerWindows extends WMICrawlerOS {
while (enumVariant.hasMoreElements()) { while (enumVariant.hasMoreElements()) {
row = new ArrayList<>(); row = new ArrayList<>(Arrays.asList(new String[metaMap.size()]));
vItem = enumVariant.nextElement(); vItem = enumVariant.nextElement();
item = vItem.toDispatch(); item = vItem.toDispatch();
for( String key : metaMap.keySet()) { for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
vValue = Dispatch.call(item, key); vValue = Dispatch.call(item, info.getKey());
value = vValue.toString(); value = vValue.toString();
vValue.safeRelease(); vValue.safeRelease();
row.add(value); row.set(info.getValue().intValue(), value);
} }
vItem.safeRelease(); vItem.safeRelease();