hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yin Huai <huaiyin....@gmail.com>
Subject question about ChecksumFSInputChecker
Date Fri, 16 Nov 2012 21:15:46 GMT
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