You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Bernard Liang <li...@gmail.com> on 2011/09/24 11:14:57 UTC

In Java, how can I create an equivalent of an Apache Avro container file without being forced to use a File as a medium?

Hello,

This is somewhat of a more advanced question regarding the Java
implementation of Avro. The details are located at the following link:

http://stackoverflow.com/questions/7537959/in-java-how-can-i-create-an-equivalent-of-an-apache-avro-container-file-without

If there is anyone that might be able to assist me with this, I would like
to get in contact with you.

Best regards,
Bernard Liang

Re: In Java, how can I create an equivalent of an Apache Avro container file without being forced to use a File as a medium?

Posted by Joe Crobak <jo...@gmail.com>.
Hi Bernard,

I think you're looking for the DataFileStream class:
http://avro.apache.org/docs/1.5.4/api/java/org/apache/avro/file/DataFileStream.html

Some of the command line tools use this class-- e.g. see
http://svn.apache.org/viewvc/avro/tags/release-1.5.4/lang/java/tools/src/main/java/org/apache/avro/tool/ToTextTool.java?revision=1169533&view=markuplines
64-69.

Best,
Joe

On Sat, Sep 24, 2011 at 5:14 AM, Bernard Liang <li...@gmail.com>wrote:

> Hello,
>
> This is somewhat of a more advanced question regarding the Java
> implementation of Avro. The details are located at the following link:
>
>
> http://stackoverflow.com/questions/7537959/in-java-how-can-i-create-an-equivalent-of-an-apache-avro-container-file-without
>
> If there is anyone that might be able to assist me with this, I would like
> to get in contact with you.
>
> Best regards,
> Bernard Liang
>

Re: In Java, how can I create an equivalent of an Apache Avro container file without being forced to use a File as a medium?

Posted by Scott Carey <sc...@apache.org>.
In addition to Joe's comments:

On the write side, DataFileWriter.create() can take a file or an output
stream.
http://avro.apache.org/docs/1.5.4/api/java/org/apache/avro/file/DataFileWrit
er.html

On the read side, DataFileStream can be used if the input does not have
random access and can be represented with an InputStream.
If the input has random access, implement SeekableInput and then construct a
DataFileReader with it:
http://avro.apache.org/docs/1.5.4/api/java/org/apache/avro/file/SeekableInpu
t.html
http://avro.apache.org/docs/1.5.4/api/java/org/apache/avro/file/DataFileRead
er.html


On 9/24/11 2:14 AM, "Bernard Liang" <li...@gmail.com> wrote:

> Hello,
> 
> This is somewhat of a more advanced question regarding the Java implementation
> of Avro. The details are located at the following link:
> 
> http://stackoverflow.com/questions/7537959/in-java-how-can-i-create-an-equival
> ent-of-an-apache-avro-container-file-without
> 
> If there is anyone that might be able to assist me with this, I would like to
> get in contact with you.
> 
> Best regards,
> Bernard Liang