avroDatastream = getAvroDataStream(fs, path);
Schema schema = avroDatastream.getSchema();
DatumWriter<Object> avroWriter = new GenericDatumWriter<Object>(schema);
JsonGenerator g = new JsonFactory().createJsonGenerator(outputStream, JsonEncoding.UTF8);
g.useDefaultPrettyPrinter();
Encoder encoder = new JsonEncoder(schema, g);
int lineno = 1; // line number starts from 1
while(avroDatastream.hasNext() && lineno <= endLine) {
Object datum = avroDatastream.next();