File的用法

发布时间:2026/6/27 22:33:31

File的用法 File f1new File(C:\\Users\\喜一新\\Desktop\\t1);byte fb[]new byte[1024];传递字节为1024File[] files f1.listFiles();展示全部fos.write(len^4);给文件加密String s sb.toString(); String[] arr s.split(-);按照-区分出里面的东西int i Integer.parseInt(s1);将字符转变为整数fw.write(list.get(i)); fw.write(list.get(i)-);写出来的为数字或者为数字加-Integer[] arr Arrays.stream(sb.toString().split(-)).按照-将字符分开 map(Integer::parseInt).将字符变为整数 sorted().按正常顺序排序 toArray(Integer[]::new);将他变成数组BufferedInputStream bisnew BufferedInputStream(new FileInputStream(newDay16\\a.txt));字节缓冲流br.readLine()打印一行 bw.write(我好像爱上了打游戏); bw.newLine();写上去一行字符缓冲流Collections.sort(list,new ComparatorString()排序从小到大MAP.entrySit为展示全部键值对ObjectOutputStream oosnew ObjectOutputStream(new FileOutputStream(newDay20\\a.txt));oos.writeObject(s);序列化流ObjectInputStream oisnew ObjectInputStream(new FileInputStream(newDay20\\a.txt));ois.readObject();反序列化流implements Serializable private static final long serialVersionUID 9071719665169116302L;要继承还要有设置oos.writeObject(list);ArrayListpeople o (ArrayListpeople) ois.readObject();可以放入集合中

相关新闻