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         } 
  • 相关阅读:
    SQL Server数据库损坏、检测以及简单的修复办法
    迭代法
    求两个数组的交集
    jQuery的动画处理总结
    ASP.NET MVC企业开发的基本环境
    ASP.NET WebForm 的路由
    CMStepCounter Class Refernce
    C++输入一个字符串,把其中的字符按照逆序输出的两种方法
    5.2 列出表的列
    Mac Outlook数据文件的位置
  • 原文地址:https://www.cnblogs.com/tian830937/p/4431951.html
Copyright © 2011-2022 走看看