hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yin Huai <huaiyin....@gmail.com>
Subject Re: question about ChecksumFSInputChecker
Date Tue, 27 Nov 2012 19:52:37 GMT
Is there anyone who can answer my question?

Thansk,

Yin

On Fri, Nov 16, 2012 at 4:15 PM, Yin Huai <huaiyin.thu@gmail.com> wrote:

> Hi All,
>
> I have a question about the method read in CheckSumFSInputChecker. Can you
> let me know why the file will be opened and closed for every read operation?
>
> thanks,
>
> Yin
>
> Here is the code of CheckSumFSInputChecker.read(...) ...
> public int read(long position, byte[] b, int off, int len)
>       throws IOException {
>       // parameter check
>       if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
>         throw new IndexOutOfBoundsException();
>       } else if (len == 0) {
>         return 0;
>       }
>       if( position<0 ) {
>         throw new IllegalArgumentException(
>             "Parameter position can not to be negative");
>       }
>
>       ChecksumFSInputChecker checker = new ChecksumFSInputChecker(fs,
> file);
>       checker.seek(position);
>       int nread = checker.read(b, off, len);
>       checker.close();
>       return nread;
>     }
>
>

Mime
View raw message