zoukankan      html  css  js  c++  java
  • java学习123>>IO

    1. import java.io.File;

    2. File f1 = new File(“d:\a.txt”);

    3. public File(String pathname) public File(String parent, String child)

    4. public boolean createNewFile() throws IOException创建文件

    5. public boolean delete()删除文件或文件夹,如果文件夹,则需要空

    6. public boolean exists()是否存在

    7.  public String getAbsolutePath()

    8.  public String getName()

    9.  public String getParent()

    10.  public boolean isDirectory()

    11. public boolean isFile()

    12. public long length()

    13. public String[] list()所有文件夹和文件,非绝对路径

    14. public File[] listFiles()当前文件夹下所有的文件对象

    15. public boolean mkdir()

    16. public boolean mkdirs()如果父目录不存在,则创建

    17. public boolean renameTo(File dest)如果有同名的,修改失败

    18. public boolean setReadOnly()改属性

    19. try{ boolean b = f3.createNewFile(); }catch(Exception e){e.printStackTrace();}

    20. String[] s = f1.list(); for(int i = 0;i < s.length;i++){ System.out.println(s[i]); }

    21. 文件的输入和输出java.io.PrintWriter   

    22. PrintWriter(file:FILE) PrintWriter(filename:String)

    23. print(string,int,long...) println

    24. 最后要close();

    25. java.util.Scanner

    26. Scanner(file:File, name:String);

    27. Close();

    28. hasNext():boolean;如果还有可读数据则为true

    29. Next():string nextLine():string nextByte()...

    30. InputStream {FileInputStream FilterInputStream{DataInputStream, BufferInputStream} ObjectInputStream}
    OutputStream{FileOutputSteam FilterOutputStream{DataOutputStream BufferInputStream} ObjectOutputStream}

    31. InputStream{read(); available();close();skip();markSupported();mark();reset()

    32. OutputStream{write(); close(); flush()}

    33. DataInputStream{readBoolean(); readByte(); readChar()...readUTF();readLine()}

    34. DataOutputStream{writeBoolean()...}

    35. java.io.RandomAccessFile{close();getFilePointer();lenght();read();seek();setLength();skipBytes();write();

    每天早上叫醒你的不是闹钟,而是心中的梦~
  • 相关阅读:
    vue开发常用技巧总结(一)
    js时间戳转固定日期格式输出处理
    vue恢复初始数据
    Feature Police导致iframe页面无法使用粘贴功能
    页面异步请求canceled 或 network中接口请求成功但无法查看返回值
    我在阿里云做云开发平台
    Python项目中的requirements文件
    Json常用格式
    浅谈开机启动_windows
    mmdetection 报错: AttributeError: ‘ConfigDict‘ object has no attribute ‘pipeline‘
  • 原文地址:https://www.cnblogs.com/vintion/p/4116935.html
Copyright © 2011-2022 走看看