上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 31 下一页
摘要: public static void main(String[] args){ Scanner sc = new Scanner(System.in); FileOutputStream fos = new FileOutputStream ("test.txt"); //创建输出流对象,关联tes 阅读全文
posted @ 2020-06-19 21:49 一块 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 在控制台录入文件的路径,将文件拷贝到当前项目下。 分析: 1.定义方法对键盘录入的路径进行判断,如果是文件就返回。 2.在主方法中接收该文件。 3.读和写该文件。 public static void main(){ File file = getFile(); //获取文件 BufferedInp 阅读全文
posted @ 2020-06-18 22:16 一块 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 將寫出的字異或上一個數,這個數就是密碼,解密的時候再次異或就可以了 public static void main(String [] args){ BufferedInputStream bis = new BufferedInputStream(new FileInputStream("紫薇.j 阅读全文
posted @ 2020-06-18 21:55 一块 阅读(206) 评论(0) 推荐(0) 编辑
摘要: public static void main(String [] args) throws IOException{ try( FileInputStream fis = new FileInputStream ("xxx.txt"); FileOutputStream fos = new Fil 阅读全文
posted @ 2020-06-18 21:43 一块 阅读(155) 评论(0) 推荐(0) 编辑
摘要: FileOutputStream fos = new FileOutputStream ("zzz.txt"); fos.write("我读书少,你不要骗我".getBytes()); //将字符串转换为字节数组,然后写出 fos.write("\r\n"getBytes()); //换到下一行 f 阅读全文
posted @ 2020-06-17 21:57 一块 阅读(161) 评论(0) 推荐(0) 编辑
摘要: FileInputStream fis = new FileInputStream ("yyy.txt"); byte[] arr = new byte[2];//定义字节数组空间为2 int len; while(len = fis.read(arr) != -1){ //将字节流读取到字节数组中 阅读全文
posted @ 2020-06-17 21:49 一块 阅读(417) 评论(0) 推荐(0) 编辑
摘要: A:缓冲思想 字节流一次读写一个数组的速度明显比一次读写一个字节的速度快很多。 这是加入了数组这样的缓冲区效果,JAVA本身在设计的时候,也考虑到了这样的设计思想,所以同乐字节缓冲区流。 B:BufferedInputStream内置了一个缓冲区(数组),从BufferedInputStream中读 阅读全文
posted @ 2020-06-15 21:19 一块 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 1.集合主要包含collection和map两个接口。其中collection中的元素是一个value值,map中的元素是key:value形式的。 2.collection包含set、list。 3.List接口:list接口包含ArrayList,LinkedList,Vector。 4.set 阅读全文
posted @ 2020-06-05 11:16 一块 阅读(87) 评论(0) 推荐(0) 编辑
摘要: FileInputStream fis = new FileInputStream ("test.txt");//创建读取管道 byte[] arr = new byte[2]; //创建字节数组 int a = fis.read(arr); //将文件上的字节读取到字节数组中(a为读取到的有效字节 阅读全文
posted @ 2020-06-03 21:58 一块 阅读(845) 评论(0) 推荐(0) 编辑
摘要: FileInputStream fis = new FileInputStream ("致青春.mp3"); //创建输入流对象,关流音频文件 FileOutputStream fos = new FileOutputStream ("copy.mp3");//创建输出流对象,关联copy.mp3 阅读全文
posted @ 2020-06-01 22:11 一块 阅读(462) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 31 下一页