//
// Apply the typetree's parser.
//
if (jsonDataFile != null) {
Schema schema = typeTree.getAvroSchema();
GenericDatumWriter jsonGDWriter = new GenericDatumWriter(schema);
BufferedOutputStream outJson = new BufferedOutputStream(fs2.create(jsonDataFile));
JsonEncoder encoder = EncoderFactory.get().jsonEncoder(schema, outJson);
try {
in = new BufferedReader(new InputStreamReader(fs.open(p)));
try {
String str = in.readLine();
while (str != null) {
GenericContainer gct = typeTree.parse(str);
if (gct != null) {
jsonGDWriter.write(gct, encoder);
}
str = in.readLine();
}
} finally {
in.close();
}
} finally {
encoder.flush();
outJson.close();
}
}
if (avroDataFile != null) {
int numGoodParses = 0;
int lineno = 0;
Schema schema = typeTree.getAvroSchema();
GenericDatumWriter gdWriter = new GenericDatumWriter(schema);
DataFileWriter outData = new DataFileWriter(gdWriter);
outData = outData.create(schema, fs2.create(avroDataFile));
try {
in = new BufferedReader(new InputStreamReader(fs.open(p)));