public static void checkDir(final File dir) {
        if (!dir.exists()) {
            if (!dir.mkdirs()) {
                throw new RuntimeException(new StringBuilder(512)
                        .append("Create directory failed:")
                        .append(dir.getAbsolutePath()).toString());
            }
        }
        if (!dir.isDirectory()) {
            throw new RuntimeException(new StringBuilder(512)
                    .append("Path is not a directory:")
                    .append(dir.getAbsolutePath()).toString());
        }
    }
Delete the contents of files and subdirectories in the specified directory

@param dir            the specified directory
@return               the deleted count
@throws IOException   the exception while deleting contents
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/utils/FileUtil.java