文件管理 · 2022年7月25日

java文件管理程序代码|急求Java简单文件管理类程序

㈠ 求一个简单的用java语言编写的文件管理器的源代码🙏

public class complie { int i,j; public complie(int i,int j)//构建一个复数类 { this.i=i; this.j=j; } complie add(complie c)//复数加法 { int l,k; l=c.i+i; k=c.j+j; return (new complie(l,k)); } complie cut(complie c)//复数减法 { int l,k; l=i-c.i; k=j-c.j; return (new complie(l,k)); } void ToString()//将复数输出 { System.out.println("复数为:"+i+"+"+j+"i"); }public static void main(String[] args) { complie a=new complie(4,5); complie b=new complie(2,3); System.out.println("构造的复数类为:"); a.ToString(); b.ToString(); System.out.println("运算复数a+b=:"); a.add(b).ToString(); System.out.println("运算复数a-b=:"); a.cut(b).ToString(); }}

㈡ java文件管理器编程

Scanner in = new Scanner(System.in);String filePath = in.nextLine();File currentFile = new File(filePath);File[] childFiles = currentFile.listFiles(); // 得到当前目录下的所有文件(文件夹)File file = childFiles[0]; // 选择一个文件file.delete(); // 删除选择文件file = new File(currentFile, "newDirectotyName");file.mkdir(); // 创建一个目录file.createNewFile();// 创建文件

㈢ java语句,个人通讯录管理程序(分别使用文件及数据库的方式对数据进行管理),我要全代码的,帮帮忙,谢谢

小兄弟,你的这个有点复杂。

㈣ 求一个用java编写的简单的文件管理器的源代码

加入i码邦,参加java编程神器的每日一练,可以发布自己的问题,有专家解答。

随时随地可以写代码的i码邦app,让你学习java不再困难!

㈤ 求文件管理器 能管理JAVA的

去手机之家选择你的手机品牌和型号后你就可以看见自己手机专用的JAVA程序了至于文件管理器那就麻烦你找找看了

㈥ 急求Java简单文件管理类程序

这是别人写好的package sunnykid.file;import java.io.*;import sunnykid.text.SunnykidNumber;/** * <p>标题: JAVA文件操作工具类</p> * <br> * <p>描述: 阳光软体工作室常用工具包</p> * <br> * <p>版权: 版权所有 (c) 2007</p> * <br> * <p>组织: 阳光软体工作室</p> * * @author 钟晓籁 * @version V1.0 */public class FileOperator { /** * 不带参数的构造函数 */ public FileOperator() { super(); } /** * 删除指定的文件 * @param filepath String 待删除的文件路径及名称 * @throws IOException */ public void delete(String filepath) throws IOException { Runtime rt = Runtime.getRuntime(); rt.exec("cmd /c del " + filepath); } /** * 将字符串写入文件 * @param content String 待写入的字符串内容 * @param filepath String 待写入的文件路径及名称 * @throws IOException */ public void write(String content, String filepath) throws IOException { File file = new File(filepath); FileWriter fw = new FileWriter(file); fw.write(content); fw.close(); } /** * 读取文件中的内容 * @param filepath String 待读取的文件路径及名称 * @return String 返回从文件中读取的字符串内容 * @throws IOException */ public String read(String filepath) throws IOException { int text = 0; File file = new File(filepath); FileReader fr = new FileReader(file); int len = (int) file.length(); char[] buffer = new char[len]; while (fr.ready()) { text = text + fr.read(buffer, text, len – text); } fr.close(); String content = new String(buffer, 0, text); return content; } /** * 判断一个文件是否存在 * @param filepath String 待判断的文件路径及名称 * @return boolean 返回文件是否存在结果 */ public boolean isExist(String filepath) { File file = new File(filepath); if (file.exists()) { return true; } else { return false; } } /** * 重命名文件或目录 * @param oldname String 重命名前的文件或目录名称 * @param newname String 重命名后的文件或目录名称 * @return boolean 返回操作是否成功结果 */ public boolean rename(String oldname, String newname) { File oldfile = new File(oldname); File newfile = new File(newname); boolean success = oldfile.renameTo(newfile); return success; }/** * 剪切指定文件至指定的目录 * @param from String 源文件的路径及名称 * @param to String 目标路径及名称 */ public void move(String from, String to) { File oldfile = new File(from); File newfile = new File(to); oldfile.renameTo(newfile); }/** * 拷贝指定文件至指定的目录 * @param from String 源文件的路径及名称 * @param to String 目标路径及名称 * @throws IOException */ public void (String from, String to) throws IOException { int BUFF_SIZE = 100000; byte[] buffer = new byte[BUFF_SIZE]; InputStream in = null; OutputStream out = null; try { in = new FileInputStream(from); out = new FileOutputStream(to); while (true) { synchronized (buffer) { int amountRead = in.read(buffer); if (amountRead < 0) { break; } out.write(buffer, 0, amountRead); } } } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } }/** * 获取文件扩展名 * @param filename String 需要获取大小的文件之完整路径 * @return String 返回文件扩展名 */ public String getExtension(String filename) { String defExt = null; if ((filename != null) && (filename.length() > 0)) { int i = filename.lastIndexOf('.'); if ((i > 0) && (i < (filename.length() – 1))) { defExt = filename.substring(i + 1); } } return defExt; } /** * 获取文件字节数 * @param filename String 需要获取大小的文件之完整路径 * @return long 返回文件大小字节数 */ public long fileSize(String filename) { long size = 0L; File file = new File(filename); if (this.isExist(filename) == true) { size = file.length(); } return size; } /** * 获取标准单位之文件大小 * @param bytesize long 需要转换为标准单位的文件之字节数 * @return String 返回标准单位之文件大小 */ public String switchSize(long bytesize) { String size = ""; SunnykidNumber sn=new SunnykidNumber(); float number = 0.0f; if (bytesize <= 0) { size = "0Bytes"; } else if (bytesize < 1024) { size = String.valueOf(size) + "Bytes"; } else if (bytesize < 1048576) { number = (float) bytesize / 1024; size = sn.parseCurrency(number) + "KB"; } else if (bytesize < 1073741824) { number = (float) bytesize / 1024 / 1024; size = sn.parseCurrency(number) + "MB"; } else if (bytesize < 1099511627776L) { number = (float) bytesize / 1024 / 1024 / 1024; size = sn.parseCurrency(number) + "GB"; } return size; }} ====================package sunnykid.text;import java.text.*;/** * <p>标题: 用於操作数字的类</p> * <br> * <p>描述: 阳光软体工作室常用工具包</p> * <br> * <p>版权: 版权所有 (c) 2007</p> * <br> * <p>组织: 阳光软体工作室</p> * * @author 钟晓籁 * @version V1.0 */public class SunnykidNumber { /** * 不带参数的构造函数 */ public SunnykidNumber() { super(); } /** * 将数字格式化成货币样式 * @param unfmt_dbl double 未经格式化的数字 * @return String 返回按照货币样式格式化后的字符串 */ public String getCurrency(double unfmt_dbl) { //双精度数转化成货币类型两位小数 NumberFormat nf = NumberFormat.getCurrencyInstance(); //按照货币类型格式化数字 String fmted_str = nf.format(unfmt_dbl); return fmted_str; } /** * 按照货币类型格式化数字 * @param unfmt_dbl double 未经格式化的数字 * @return String 返回按照货币类型格式化后的字符串 */ public String parseCurrency(double unfmt_dbl) { //双精度数转化成货币类型两位小数的字符串 DecimalFormat df = new DecimalFormat("#.00"); //按照货币类型格式化数字 String fmted_str = df.format(unfmt_dbl); return fmted_str; }/** * 双精度小数转化成百分数 * @param unfmt_dbl double 未经格式化的数字 * @return String 返回按照百分比样式格式化后的字符串 */ public String parsePercect(double unfmt_dbl) { //双精度小数转化成百分数 NumberFormat nf = NumberFormat.getPercentInstance(); //按照百分比格式化数字// nf.setMinimumIntegerDigits(integ);// 设置数的整数部分所允许的最大位数// nf.setMaximumFractionDigits(fract);// 设置数的小数部分所允许的最大位数 String fmted_str = nf.format(unfmt_dbl); return fmted_str; } /** * 双精度小数四舍五入为整数 * @param unfmt_dbl double 未经转化的小数 * @return int 小数四舍后得到的整数 */ public int roundNumber(double unfmt_dbl) { String temp_str = String.valueOf(unfmt_dbl); //将小数转化为字符串 if (temp_str.indexOf(".") <= 0) { } int indexOfDot = temp_str.indexOf("."); //获取小数点位置 int temp_int = Integer.parseInt(temp_str.substring(indexOfDot + 1, indexOfDot + 2)); if (temp_int < 5) { //判断小数点后一位的数字是否大於5 return Integer.parseInt(temp_str.substring(0, indexOfDot)); //四舍 } else { return Integer.parseInt(temp_str.substring(0, indexOfDot)) + 1; //五入 } }}

㈦ 谁有java写的文件管理系统的源代码

OpenKM,开源内容管理引擎,超级好下载下来直接部署就能用,代码层次也很高,如果能读进去,你可以直接去做ecm开发了

㈧ 求帮写个JAVA简易文件管理器

还没写好吗 我可以给你写 see my name , find me

㈨ 哪里有文件管理的java代码

文件管理?你说的是像图书馆管理系统这样的项目吧 你可以参考《java项目开发案例精粹》