⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diskchecker.java

📁 hadoop:Nutch集群平台
💻 JAVA
字号:
package org.apache.hadoop.util;import java.io.File;import java.io.IOException;/** * Class that provides utility functions for checking disk problem * @author Hairong Kuang */public class DiskChecker {    public static class DiskErrorException extends IOException {      public DiskErrorException(String msg) {        super(msg);      }    }        public static class DiskOutOfSpaceException extends IOException {        public DiskOutOfSpaceException(String msg) {          super(msg);        }      }          public static void checkDir( File dir ) throws DiskErrorException {        if( !dir.exists() && !dir.mkdirs() )            throw new DiskErrorException( "can not create directory: "                     + dir.toString() );                if ( !dir.isDirectory() )            throw new DiskErrorException( "not a directory: "                     + dir.toString() );                    if( !dir.canRead() )            throw new DiskErrorException( "directory is not readable: "                     + dir.toString() );                    if( !dir.canWrite() )            throw new DiskErrorException( "directory is not writable: "                     + dir.toString() );    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -