You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by iGama <ma...@gmail.com> on 2009/11/04 12:28:13 UTC

Get File object from HDFS with Java

Hy all. I'm using Java.

I Have a function that receives a File ( it manipulates images ). in a 
local file system I would use :

File imageFile = new File(path);

But to run in hadoop, what would be the best way to acheve this?

At this point, what I have figured out , would something in the lines of :

Path imagePath = new Path("/user/guest" + separator + imageDir + 
separator + imageFile);
FSDataInputStream dis = hdfs.open(imagePath);

but, how to I get the object File ?

Any sugestions?

Thanks,

Marco

Re: Get File object from HDFS with Java

Posted by Jeff Zhang <zj...@gmail.com>.
No sure why you need file object.
in hdfs, Path is something like File Object in local filesystem.

Jeff Zhang



On Wed, Nov 4, 2009 at 3:28 AM, iGama <ma...@gmail.com> wrote:

> Hy all. I'm using Java.
>
> I Have a function that receives a File ( it manipulates images ). in a
> local file system I would use :
>
> File imageFile = new File(path);
>
> But to run in hadoop, what would be the best way to acheve this?
>
> At this point, what I have figured out , would something in the lines of :
>
> Path imagePath = new Path("/user/guest" + separator + imageDir + separator
> + imageFile);
> FSDataInputStream dis = hdfs.open(imagePath);
>
> but, how to I get the object File ?
>
> Any sugestions?
>
> Thanks,
>
> Marco
>