Yes, it will return in bytes.

NN side code where it is summing the bytes

for(Block blk : blocks) {
      bytes += blk.getNumBytes();
}

Thanks
Uma  
----- Original Message -----
From: Steve Lewis <lordjoe2...@gmail.com>
Date: Friday, November 4, 2011 2:24 am
Subject: Re: What is the approved way in 0.20 to get a file size
To: hdfs-user@hadoop.apache.org

> I read that getLen returns the length in Blocks - and I wrong and 
> does it
> return the length in bytes
> the code I see in org.apache.hadoop.fs.FileStatus says
> 
> /*
>   * @return the length of this file, in blocks
>   */
>  public long getLen() {
>    return length;
>  }
> 
> 
> On Thu, Nov 3, 2011 at 11:39 AM, Harsh J <ha...@cloudera.com> wrote:
> 
> > You need to use:
> >
> >
> > 
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileStatus.html#getLen()>
> > via
> > 
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#getFileStatus(org.apache.hadoop.fs.Path)>
> > On Thu, Nov 3, 2011 at 11:59 PM, Steve Lewis <lordjoe2...@gmail.com>
> > wrote:
> > > FileSystem.getLength(Path path) is deprecated
> > > getFileStatus(Path path) .getLen(String path)  seems to return 
> the path
> > in
> > > Blocks whereas I want it in bytes
> > > --
> > > Steven M. Lewis PhD
> > > 4221 105th Ave NE
> > > Kirkland, WA 98033
> > > 206-384-1340 (cell)
> > > Skype lordjoe_com
> > >
> > >
> > >
> >
> >
> >
> > --
> > Harsh J
> >
> 
> 
> 
> -- 
> Steven M. Lewis PhD
> 4221 105th Ave NE
> Kirkland, WA 98033
> 206-384-1340 (cell)
> Skype lordjoe_com
> 

Reply via email to