void read2xml() throws IOException, XMLStreamException {
XMLOutputFactory fac = XMLOutputFactory.newInstance();
String fileout = "D:/bufr/out/test5.xml.gzip";
FileOutputStream fos = new FileOutputStream(fileout);
GZIPOutputStream zos = new GZIPOutputStream(fos);
//staxWriter = fac.createXMLStreamWriter(System.out, "UTF-8");
//staxWriter = fac.createXMLStreamWriter(fos, "UTF-8");
staxWriter = fac.createXMLStreamWriter(zos, "UTF-8");
staxWriter.writeStartDocument("UTF-8", "1.0");
staxWriter.writeCharacters("\n");
staxWriter.writeStartElement("bufrMessages");
String filename = "D:/bufr/mlodeSorted/IUSUV1KWBC.bufr";
//String filename = "D:/bufr/out/IUACRJTD-1.bufr";
//String filename = "D:/bufr/mlodeSorted/ISXAB40KWNO.bufr";
test(filename, new MClosure() {
public void run(String filename) throws IOException {
scan(filename);
}
});
staxWriter.writeCharacters("\n");
staxWriter.writeEndDocument();
staxWriter.flush();
zos.close();
out.flush();
}