|
|
|
@ -3,10 +3,13 @@ package org.leolo.rail.nrd; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.FileReader; |
|
|
|
|
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
|
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URLConnection; |
|
|
|
import java.net.URLConnection; |
|
|
|
@ -14,6 +17,7 @@ import java.util.Base64; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.zip.GZIPInputStream; |
|
|
|
import java.util.zip.GZIPInputStream; |
|
|
|
|
|
|
|
import java.util.zip.GZIPOutputStream; |
|
|
|
import java.util.zip.ZipException; |
|
|
|
import java.util.zip.ZipException; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
@ -71,9 +75,9 @@ public class FileLoader { |
|
|
|
GZIPInputStream gis = new GZIPInputStream(fis); |
|
|
|
GZIPInputStream gis = new GZIPInputStream(fis); |
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(gis)); |
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(gis)); |
|
|
|
){ |
|
|
|
){ |
|
|
|
PrintWriter ass = new PrintWriter(new File(tempDir, "ass_0")); |
|
|
|
PrintWriter ass = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "ass_0")))); |
|
|
|
PrintWriter tip = new PrintWriter(new File(tempDir, "tip_0")); |
|
|
|
PrintWriter tip = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "tip_0")))); |
|
|
|
PrintWriter sch = new PrintWriter(new File(tempDir, "sch_0")); |
|
|
|
PrintWriter sch = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "sch_0")))); |
|
|
|
int count = 0; |
|
|
|
int count = 0; |
|
|
|
while(true) { |
|
|
|
while(true) { |
|
|
|
String line = br.readLine(); |
|
|
|
String line = br.readLine(); |
|
|
|
@ -90,21 +94,21 @@ public class FileLoader { |
|
|
|
countA++; |
|
|
|
countA++; |
|
|
|
if(countA%Constants.BATCH_SIZE==0) { |
|
|
|
if(countA%Constants.BATCH_SIZE==0) { |
|
|
|
ass.close(); |
|
|
|
ass.close(); |
|
|
|
ass = new PrintWriter(new File(tempDir, "ass_"+(++batchA))); |
|
|
|
ass = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "ass_"+(++batchA))))); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if("TiplocV1".equals(objectType)){ |
|
|
|
}else if("TiplocV1".equals(objectType)){ |
|
|
|
tip.println(obj.getJSONObject("TiplocV1")); |
|
|
|
tip.println(obj.getJSONObject("TiplocV1")); |
|
|
|
countT++; |
|
|
|
countT++; |
|
|
|
if(countT%Constants.BATCH_SIZE==0) { |
|
|
|
if(countT%Constants.BATCH_SIZE==0) { |
|
|
|
tip.close(); |
|
|
|
tip.close(); |
|
|
|
tip = new PrintWriter(new File(tempDir, "tip_"+(++batchT))); |
|
|
|
tip = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "tip_"+(++batchT))))); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if("JsonScheduleV1".equals(objectType)){ |
|
|
|
}else if("JsonScheduleV1".equals(objectType)){ |
|
|
|
sch.println(obj.getJSONObject("JsonScheduleV1")); |
|
|
|
sch.println(obj.getJSONObject("JsonScheduleV1")); |
|
|
|
countS++; |
|
|
|
countS++; |
|
|
|
if(countS%Constants.BATCH_SIZE==0) { |
|
|
|
if(countS%Constants.BATCH_SIZE==0) { |
|
|
|
sch.close(); |
|
|
|
sch.close(); |
|
|
|
sch = new PrintWriter(new File(tempDir, "sch_"+(++batchS))); |
|
|
|
sch = new PrintWriter(new GZIPOutputStream(new FileOutputStream(new File(tempDir, "sch_"+(++batchS))))); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if("EOF".equals(objectType)){ |
|
|
|
}else if("EOF".equals(objectType)){ |
|
|
|
//Nothing to do
|
|
|
|
//Nothing to do
|
|
|
|
|