[java]
/*采用递归的方式*/ public void getBlockInfo(TreeSet<Block> blockSet) { if (children != null) { for (int i = 0; i < children.length; i++) { children[i].getBlockInfo(blockSet); } } File blockFiles[] = dir.listFiles(); for (int i = 0; i < blockFiles.length; i++) { if (Block.isBlockFilename(blockFiles[i])) { long genStamp = getGenerationStampFromFile(blockFiles, blockFiles[i]); blockSet.add(new Block(blockFiles[i], blockFiles[i].length(), genStamp)); } } } 4.获取存储目录下的所有数据块的卷信息