蒲公英_gJM1Z 发表于 2015-3-31 22:12:16

怎样在程序中得到HDFS的块大小

现在要在MR里面得到块的大小,怎样在程序中得到HDFS的块大小

jixianqiuxue 发表于 2015-3-31 22:27:14

public long getBlockSize() {
    return blocksize;
}
返回块的大小
long blockSize = file.getBlockSize();

jixianqiuxue 发表于 2015-3-31 22:31:15



getBlockSize

public long getBlockSize(Path f)
                  throws IOException
Get the block size for a particular file.
Specified by:
getBlockSize in class FileSystem
Parameters:
f - the filename
Returns:
the number of bytes in a block
Throws:
IOException

地址:http://web.mit.edu/mriap/hadoop/hadoop-0.13.1/docs/api/org/apache/hadoop/fs/FilterFileSystem.html#getBlockSize


页: [1]
查看完整版本: 怎样在程序中得到HDFS的块大小