Created
January 17, 2014 16:34
-
-
Save GLitchfield/8476497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FilterHistoricData { | |
public static final String SYMBOL1 = "XFU4"; | |
public static final String SYMBOL2 = "XFH4"; | |
public static final String SYMBOL3 = "XFK4"; | |
/** ddf time stamp encoding/decoding mask */ | |
final static int DDF_TIME_STAMP_MASK = 0x40; | |
final static byte DDF_CENTURY = 0x14; | |
public static void main(final String[] args) throws Exception { | |
final File data = new File("/home/gavin/Desktop/Feed 20140114.zip"); | |
final ZipFile zFile= new ZipFile(data); | |
final ZipEntry entry = zFile.entries().nextElement(); | |
final InputStream inStream = zFile.getInputStream(entry); | |
final Reader inStreamReader = new InputStreamReader(inStream); | |
final BufferedReader bufReader = new BufferedReader(inStreamReader); | |
final File outFile = new File(".../XF_20140113.txt"); | |
final OutputStream outStream = new FileOutputStream(outFile, true); // append true for concat | |
final Writer writer = new OutputStreamWriter(outStream); | |
String line = bufReader.readLine(); | |
while(line != null) { | |
if(line.charAt(1) == '#') { | |
writer.write(line + "\n"); | |
System.out.println(line); | |
line = bufReader.readLine(); | |
continue; | |
} | |
if(line.contains(SYMBOL1) || line.contains(SYMBOL2) || line.contains(SYMBOL3)) { | |
writer.write(line + "\n"); | |
System.out.println(line); | |
} | |
line = bufReader.readLine(); | |
} | |
writer.close(); | |
outStream.close(); | |
inStream.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment