zoukankan      html  css  js  c++  java
  • 类的操作

    文件的创建:new File(String文件名)

                new File(String 父路径,String 子路径)

                new File(File 父路径对象,String 子路径字符串)

    FileInputStream类

    FileInputStream(String name):使用给定的文件名name创建一个FileInputStream类对象

    FileInputStream(File file):使用File对象创建FileInputStream对象

    FileoutputStream类方法与FileInputStream类相同

    FileReader与FileWriter类

            FileReader与FileWriter字符流对应了FileInputStream与FileoutputStream类。FileReader流顺序地读取文件,只要不关闭流,每次调用reader()方法就顺序地读取源中其余内容,直到源的末尾或流被关闭,由于FileInputStream与FileoutputStream类只提供了对字节或字节数组的读取方法,汉字在文件中占用两个字节,如果使用字节流,读取不好可能出现乱码现象,而采用字符流FileReader与FileWriter类可避免此现象的发生。

  • 相关阅读:
    小记2_finddata_t结构体
    小记1
    2014-1-2 笔记
    _RecordsetPtr的 open函数
    SAFEARRAY
    用VC实现特定编辑框上对回车键响应
    常用控件的常用消息
    单文档与多文档
    java中得到json格式的数据
    form表单验证时的onsubmit事件
  • 原文地址:https://www.cnblogs.com/zhaoyuxiao000/p/14168970.html
Copyright © 2011-2022 走看看