文件的判断

您所在的位置:网站首页 pdf文件导入 文件的判断

文件的判断

2023-02-22 11:40| 来源: 网络整理| 查看: 265

/*文件的判断功能: * public boolean isDirectory() * public boolean isFile() * public boolean exists() * public boolean canRead() * public boolean canWrite() * public boolean isHidden() *  * */import java.io.File;import java.io.IOException;

public class FilePanduan {

public static void main(String[] args) throws IOException {// TODO Auto-generated method stubFile file = new File("b.mp3");System.out.println(""+file.createNewFile());System.out.println("判断是否是文件的目录:"+file.isDirectory());System.out.println("判断是否是文件:"+file.isFile());System.out.println("判断文件是否存在:"+file.exists());System.out.println("判断文件是否是可读的:"+file.canRead());System.out.println("判断文件是否是可写的:"+file.canWrite());System.out.println("判断文件是否是隐藏的:"+file.isHidden());/** public String getAbsolutePath()public String getPath()public String getName()public long length()public long lastModified()

* */System.out.println("获取的绝对路径:"+file.getAbsolutePath());  System.out.println("获取的相对路径:"+file.getPath()); System.out.println("获取的名称:"+file.getName());System.out.println("文件的字节数长度:"+file.length());System.out.println("文件最后一次修改的时间:"+file.lastModified());System.out.println("getCanonicalPath:"+file.getCanonicalPath());System.out.println("getFreeSpace:"+file.getFreeSpace());System.out.println("getParent:"+file.getParent());System.out.println("getTotalSpace:"+file.getTotalSpace());System.out.println("getUsableSpace:"+file.getUsableSpace());System.out.println("length:"+file.length());System.out.println("toString:"+file.toString());}

}

0 0 判断文件的类型 判断文件的编码 判断文件的编码 文件结束的判断 判断文件的属性 文件结尾的判断 文件的判断 文件的判断 判断Unicode编码的文件 Java:判断文件的编码 PE文件的有效性判断 shell关于文件的判断 导入文件时的判断 shell文件存在的判断 判断文件权限的方法 java判断文件的编码 判断文件的编码格式 判断dxf文件的版本 坎巴拉太空计划MOD:kRPC0.2.2中文文档 内部类和匿名内部类的学习心得 spring和mybatise的整合 文件及文件夹的新建与删除 LeetCode之7_Reverse Integer 文件的判断 文件重命名 Muduo网络库源码分析(二) 定时器TimeQueue,Timer,TimerId 关于使用微信登录第三方APP的实现(Android版) 杭电2612 无参构造方法和有参构造方法的调用 字符串存成excel表范例 yii2入口文件 bzoj 4475: [Jsoi2015]子集选取


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3