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();

    每天早上叫醒你的不是闹钟,而是心中的梦~
  • 相关阅读:
    最方便建立进程池,线程池的方法
    python并发编程之多线程
    Cpython解释器支持的进程与线程
    进程与线程理论基础
    爬虫关于高性能方面
    Python中 and,or 的计算规则
    存储库之——MongoDB
    解析库之——beautifulsoup
    破解极验滑动验证码
    爬取拉勾网示例
  • 原文地址:https://www.cnblogs.com/vintion/p/4116935.html
Copyright © 2011-2022 走看看