• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






唯💗独爱你

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2023年3月10日

字符输入流_FileReader
摘要: public static void main(String[] args) throws IOException { // 一次读取一个字符 FileReader fr = new FileReader("a.txt"); int b; while ((b = fr.read()) != -1) 阅读全文
posted @ 2023-03-10 21:05 唯💗独爱你 阅读(18) 评论(0) 推荐(0)
 
字符输出流_FileWriter
摘要: public static void main(String[] args) throws IOException { File f = new File("a.txt"); // 注意:1、如果文件不存在,就创建文件,但要保证父级路径存在,如果文件存在,FileWriter fw = new Fi 阅读全文
posted @ 2023-03-10 16:11 唯💗独爱你 阅读(25) 评论(0) 推荐(0)
 
解码和编码
摘要: public static void main(String[] args) throws IOException { // 编码:将字符编译为字节,可以用默认的utf-8或者指定的字符集编码 String s = "真正的大师永远都怀着一颗学徒的心"; byte[] bytes = s.getBy 阅读全文
posted @ 2023-03-10 15:41 唯💗独爱你 阅读(22) 评论(0) 推荐(0)
 
字节缓冲流_BufferedInputStream&BufferedOutputStream
摘要: public static void main(String[] args) throws IOException { BufferedInputStream bis = new BufferedInputStream(new FileInputStream("a.txt")); BufferedO 阅读全文
posted @ 2023-03-10 15:03 唯💗独爱你 阅读(13) 评论(0) 推荐(0)
 
字节流读+写操作
摘要: public static void main(String[] args) throws IOException { // 将C:\\a.docx复制到当前src下copy目录中 String copyPath = "src\\copy"; String copyFile = "C:\\a.mp4 阅读全文
posted @ 2023-03-10 13:45 唯💗独爱你 阅读(21) 评论(0) 推荐(0)
 
字节输入流_FileInputStream
摘要: public static void main(String[] args) { // 字节流的读操作 FileInputStream f = null; try { // 注意:读取数据的时候,如果文件不存在,会报错 f = new FileInputStream("a.txt"); // rea 阅读全文
posted @ 2023-03-10 10:16 唯💗独爱你 阅读(17) 评论(0) 推荐(0)
 
字节输出流_FileOutputStream
摘要: public static void main(String[] args) throws IOException { // 字节流的写操作 FileOutputStream f = null; try { f = new FileOutputStream("a.txt"); // 注意:1、如果文 阅读全文
posted @ 2023-03-10 09:35 唯💗独爱你 阅读(31) 评论(0) 推荐(0)