zoukankan      html  css  js  c++  java
  • java 文件text的写入

    日志文件

     1         OutputStream out = new FileOutputStream(f, true);
     2             if (list1.size() > 0) {
     3                 int h1 = 0;
     4                 for (int m = 0; m < list1.size(); m++) {
     5 //                    drServiceCharu.deleteErrorData(list1.get(m), "");// 删除数据库中已经插入的错误表插入记录
     6                 }
     7                 String[] str = new String[list1.size()];
     8                 out.write('
    '); // 
    表示换行
     9                 out.write('
    ');
    10                 String strFalse = "更新本次操作数据库时间:" + getOpreateDbTime()
    11                         + ",以下文件操作失败
    ";
    12                 out.write(strFalse.getBytes()); // 向文件中写入数据
    13                 out.write('
    '); // 
    表示换行
    14                 out.write('
    ');
    15                 Iterator<String> it=list1.iterator();
    16                  while(it.hasNext())
    17                    {
    18                        str[h1]=(String)it.next()+ "执行失败!";
    19                        out.write(str[h1].getBytes()); // 向文件中写入数据
    20                         out.write('
    '); // 
    表示换行
    21                         out.write('
    ');
    22                         h1++;
    23                    }
    24             } 
    25             if (list2.size() > 0) {
    26                 int h2 = 0;
    27                 String[] str2 = new String[list2.size()];
    28                 out.write('
    '); // 
    表示换行
    29                 out.write('
    ');
    30                 String strSuccess = "更新操作数据库时间:" + getOpreateDbTime()
    31                         + ",全部操作成功,以下文件被成功执行!
    ";
    32                 out.write(strSuccess.getBytes()); // 向文件中写入数据
    33                 out.write('
    '); // 
    表示换行
    34                 out.write('
    ');
    35                 System.out.println("更新操作成功!" + list2.size());
    36                  Iterator<String> it2=list2.iterator();
    37                  while(it2.hasNext())
    38                    {
    39                      str2[h2]=(String)it2.next()+ "执行成功!";
    40                         out.write(str2[h2].getBytes()); // 向文件中写入数据
    41                         out.write('
    '); // 
    表示换行
    42                         out.write('
    ');
    43                    }
    44             }
    45         } 
  • 相关阅读:
    Could not find file '..inhibernate.cfg.xml'解决方法:
    图片轮播插件-carouFredSel
    C语言数组
    C语言字符串
    C语言指针基础
    python 多线程
    Andriod之Activity
    Java面向对象的编程
    C++模板编程
    关于思考
  • 原文地址:https://www.cnblogs.com/tian830937/p/4431951.html
Copyright © 2011-2022 走看看