打印txt文件信息
来源:互联网 发布:mysql分类后显示合计 编辑:程序博客网 时间:2024/05/29 13:02
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
public class PrintWelcome {
private static void printWelcome(String welcomeFileName)
{
String FS = System.getProperty("file.separator");
String welcomeFile = welcomeFileName;
File file = new File(welcomeFile);
try
{
FileReader fileReader = new FileReader(file);
BufferedReader br = new BufferedReader(fileReader);
StringBuffer sb = new StringBuffer(100);
boolean firstLine = true;
String str;
while ((str = br.readLine()) != null)
{
//String str;
if (firstLine)
{
sb.append(str);
firstLine = false;
}
else
{
sb.append("\n").append(str);
}
}
System.out.println(sb.toString());
br.close();
fileReader.close();
}
catch (Exception e)
{
System.out.println("Read welcome file error:" + e.getMessage());
}
}
public static void main(String[] args) throws Exception
{
String welcomeFile = "D:\\tomcat_portal\\bin\\portalMS\\conf\\welcome.txt";
printWelcome( welcomeFile);
}
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
public class PrintWelcome {
private static void printWelcome(String welcomeFileName)
{
String FS = System.getProperty("file.separator");
String welcomeFile = welcomeFileName;
File file = new File(welcomeFile);
try
{
FileReader fileReader = new FileReader(file);
BufferedReader br = new BufferedReader(fileReader);
StringBuffer sb = new StringBuffer(100);
boolean firstLine = true;
String str;
while ((str = br.readLine()) != null)
{
//String str;
if (firstLine)
{
sb.append(str);
firstLine = false;
}
else
{
sb.append("\n").append(str);
}
}
System.out.println(sb.toString());
br.close();
fileReader.close();
}
catch (Exception e)
{
System.out.println("Read welcome file error:" + e.getMessage());
}
}
public static void main(String[] args) throws Exception
{
String welcomeFile = "D:\\tomcat_portal\\bin\\portalMS\\conf\\welcome.txt";
printWelcome( welcomeFile);
}
}
====================================
|| S S S S DDDD PPPPP ||
|| S D D P P ||
|| S D D P P ||
|| S S S S D D P P ||
|| S D D PPPPP ||
|| S D D P ||
|| S S S S DDDD P ||
====================================
0 0
- 打印txt文件信息
- MFC 打印.txt文件
- 读取txt 文件信息
- traces.txt文件信息
- ffmpeg打印文件信息工具
- 内核信息打印到文件
- 打印日志信息到文件
- 用TXT文件输出一些信息
- 从txt文件中读取配置信息
- 打印文件行数函数信息,定位信息
- java读取txt目标文件中的数据打印到控制台
- C++打印PE文件头信息Demo
- 把内核中的信息打印到文件
- 内核中的信息打印到文件
- C++打印PE文件头信息Demo
- ios 日志信息打印到文件中
- java打印文件,类,函数,行信息
- jmap命令打印堆栈信息文件
- AJAX
- C++技术问题总结-第12篇 设计模式原则
- Android中如何通过程序打开或关闭GPS
- VB与数据库(2)
- NDK介绍
- 打印txt文件信息
- 7天后的时间 mysql , php
- #import和#include区别
- 软件测试工程师成长之路:掌握软件测试九大技术主题
- 局部特征提取
- 修正jquery的autocomplete在firefox下不支持中文输入法提交的bug
- iOS UITableViewCell AccessoryType属性
- 写一个能输出自己的c程序
- VS2008修改工程名