On 07/13/2011 12:15 PM, Wei Yang wrote: > So my questions are: 1.) Is there a way to encode the schema into the > output using the Encoder/Decoder method? 2.) Is there a way to encode > the schema into an Json output?
One can encode the schema as a string. What is the use case you have in mind? > 3.) How does the DataFileWrite/Reader, > GenericDatumWriter/Reader and Encoder/Decoder all fit together > architecturally? Encoder and Decoder are the lowest level APIs. They primarily encode and decode primitive values. These are not generally used directly by applications, although an application might use them as a event-oriented API, akin to XML's SAX. DatumReader and DatumWriter are mid-level APIs. They serialize and de-serialize Java objects using an Encoder or Decoder. Different versions are used for different Java representations of a Schema. These are used by folks implementing Avro data containers, like data files or RPC. DataFileReader and DataFileWriter are the application-level APIs. They permit one to read and write objects from files. Doug
