package test.stream;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter; /**
* 通过控制台写一个html程序,并输出
* @author Frost.Yen
* @E-mail 871979853@qq.com
* @date 2016年4月13日
*/
public class TestHtml {
public static void main(String[] args) {
BufferedReader br = null;
PrintWriter out = null;
try {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(new BufferedWriter(new FileWriter("E:\\JAVA\\Examples\\To Learn\\src\\test\\stream\\test.html")));
String str = null;
while((str = br.readLine())!=null){
if (str.equals("exit")) {
System.out.println("thank you");
break;
}
out.println(str);
}
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if(br!=null) br.close();
} catch (IOException e) {
e.printStackTrace();
} try {
if(out!=null) out.close();
} catch (Exception e) {
e.printStackTrace();
}
} }
}

运行后在控制台输入

<html>
<head><title>java test</title></head>
<body>
<marquee><h1>notic java do it<h1><marquee>
</body>
<html>
exit

回车

即可生成test.html

最新文章

  1. gitlab使用个人版v16.11
  2. C#语言实现定时开启或禁用网卡小程序
  3. 我的第二个FluentNHibernate例子with Knockout
  4. 优化与扩展Mybatis的SqlMapper解析
  5. BZOJ2049——[Sdoi2008]Cave 洞穴勘测
  6. Android动画translate坐标图
  7. LCS(打印路径) POJ 2250 Compromise
  8. 高并发网络编程之epoll详解
  9. 如何使用ZBLibrary-Android快速开发框架
  10. java连接oracle数据库的实现代码
  11. [Android] 输入系统(二)
  12. BuildSigar
  13. git使用系列(一)
  14. 关键字final的用法
  15. Leetcode_122_Best Time to Buy and Sell Stock II
  16. .netcore2.0发送邮件
  17. blfs(systemv版本)学习笔记-配置远程访问和管理lfs系统
  18. C# CheckBox与RadioButton
  19. SysTick Software Timer
  20. 腾讯云服务器 Centos6.5 安装 nginx1.12.0

热门文章

  1. ctf之加密
  2. _appstart.cshtml,_pagestart.cshtml,_viewstart.cshtml
  3. ManifoldJS
  4. datatables的Bootstrap样式的分页怎么添加首页和尾页(引)
  5. python compile
  6. C# 输出pdf文件流在页面上显示
  7. 转:在ElasticSearch之下(图解搜索的故事)
  8. MS CRM 2011的自定义和开发(11)——插件(plugin)开发(四)
  9. openssl与cryptoAPI交互AES加密解密
  10. 最小生成树算法(Prim,Kruskal)