title: convert byte array avro to parquet
body: <p>I got byte array from below code</p>
  
  <pre><code>public static byte[] jsonToAvro(String json, Schema schema) throws IOException {
  DatumReader&lt;Object&gt; reader = new GenericDatumReader&lt;&gt;(schema);
  GenericDatumWriter&lt;Object&gt; writer = new GenericDatumWriter&lt;&gt;(schema);
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  Decoder decoder = DecoderFactory.get().jsonDecoder(schema, json);
  Encoder encoder = EncoderFactory.get().binaryEncoder(output, null);
  Object datum = reader.read(null, decoder);
  writer.write(datum, encoder);
  encoder.flush();
  output.close();
  System.out.println("Serialization: " + output);
  return output.toByteArray(); }
  </code></pre>
  
  <p>Here output.toByteArray() contain byte array of avro. </p>
  
  <pre><code>FileUtils.writeByteArrayToFile(new File("C:\\Users\\xyz\\workspace\\JasonToAvro\\src\\main\\java\\json\\avro\\test.avro"), avroByteArray)
  File Avro_file = new File("C:\\Users\\xyz\\workspace\\JasonToAvro\\src\\main\\java\\json\\avro\\test.avro");
  
  static void fromAvroToParquet( File avroFile  ) throws IOException{
  GenericDatumReader&lt;Object&gt; greader = new GenericDatumReader&lt;Object&gt;();
  FileReader&lt;Object&gt; fileReader = DataFileReader.openReader(avroFile, greader);
  Schema avroSchema = fileReader.getSchema() ; //further code
  </code></pre>
  
  <p>when I am trying to convert it into file with .avro extension I am getting an error "Not an Avro data file".</p>
  
  <pre><code>Exception in thread "main" java.io.IOException: Not an Avro data file
  at org.apache.avro.file.DataFileReader.openReader(DataFileReader.java:63)
  at org.apache.avro.file.DataFileReader.openReader(DataFileReader.java:42)
  at json.avro.JasonToAvro.JasonToAvro.fromAvroToParquet(JasonToAvro.java:81)
  at json.avro.JasonToAvro.JasonToAvro.main(JasonToAvro.java:39)
  </code></pre>
  
  <p>I am referring this blog <a href="http://avrotoparquet.blogspot.in/2014/09/convert-avro-file-to-parquet-format.html" rel="nofollow">http://avrotoparquet.blogspot.in/2014/09/convert-avro-file-to-parquet-format.html</a> for avro to parquet conversion.Any other method for conversion are welcome.</p>