📄 diskchecker.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 + -