[20160731]read a file and print it on the screen
//read a file and print it on the screen
import java.io.*; public class MyPrintStreamTest2{
public static void main(String[] args) {
String filename = args[0]; // firsttime to see!!!
if(filename!=null){ list(filename,System.out); }
} public static void list(String filename,PrintStream ps){
try
{
BufferedReader br = new BufferedReader( new FileReader(filename) );
String s = null;
while ((s=br.readLine())!=null) {
ps.println(s);
}
br.close();
} catch(IOException e)
{
ps.println("reading file error!");
} }
}
[20160731]read a file and print it on the screen的更多相关文章
- learning Perl:91行有啥用? 88 print "\n----------------------------------_matching_multiple-line_text--------------------------\n"; 91 my $lines = join '', <FILE>;
89 open FILE, "< file_4_ex_ch7.txt" 90 or die "cannot open file: $!"; ...
- 主机宝(zhujibao) /a/apps/zhujibao/manager/apps/config/config.php no-password Login Vulnerabilities Based On Default cookie Verification From Default File
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 主机宝管理程序使用了CodeIgniter框架,要想在CodeIgnit ...
- Android 学习笔记之数据存储SharePreferenced+File
学习内容: Android的数据存储.... 1.使用SharedPreferences来保存和读取数据... 2.使用File中的I/O来完成对数据的存储和读取... 一个应用程序,经常需要与用 ...
- Python 通过print将数据保存到文件中
1. Print them to screen man = [] other = [] try: data = open('sketch.txt') for each_line in data: tr ...
- swat主流域文件(file.cio)参数详解——引自http://blog.sciencenet.cn/blog-922140-710636.html
% file.clo,即主流域文件用于文件管理,包括与模型选项.气候输入.数据库和输出控制相关的信息. Master Watershed File: file.cio Project Descript ...
- Java开发之File类
File类 File类是对文件系统中文件以及文件夹进行封装的对象,可以通过对象的思想来操作文件和文件夹. File类保存文件或目录的各种元数据信息,包括文件名.文件长度.最后修改时间.是否可读.获取当 ...
- File类的基本操作之读出所有目录路径
package org.mark.file; import java.io.File; /** * File类的基本操作之读出所有文件夹路径 * 假设给定一个文件夹,要求将此文件夹中的所有文件都列出来 ...
- File类学习笔记
File类 首先,要明确的一点就是,在整个IO包中,唯一表示与文件有关的类局势File类. 它可以实现创建或删除文件等操作.下面看看它的构造方法: File(String pathname) 通过将给 ...
- python文件和文件夹訪问File and Directory Access
http://blog.csdn.net/pipisorry/article/details/47907589 os.path - Common pathname manipulations 都是和路 ...
随机推荐
- The length of the string value exceeds the length configured in the mapping/parameter.
在NHibernate 3.3 中存储的字符串太长,会抛异常:The length of the string value exceeds the length configured in the m ...
- C# 6.0可能的新特性
C# 6.0可能的新特性 1.主构造函数(Primary Constructors) 主构造函数给类中的变量赋值 Before public class Point { private int x, ...
- tamper绕WAF小结
sqlmap有一些非常好的脚本,在如下的地址中你能够发现它们.使用svn检查 https://svn.sqlmap.org/sqlmap/trunk/sqlmap sqlmap-dev 事实上,脚本的 ...
- ehcache memcache redis 三大缓存男高音
最近项目组有用到这三个缓存,去各自的官方看了下,觉得还真的各有千秋!今天特意归纳下各个缓存的优缺点,仅供参考! Ehcache 在java项目广泛的使用.它是一个开源的.设计于提高在数据从RDBMS ...
- Struts2 action的单例与多例
struts 2的Action是多实例的并非单例,也就是每次请求产生一个Action的对象.原因是:struts 2的Action中包含数据,例如你在页面填写的数据就会包含在Action的成员变量里面 ...
- Linux下中文字符乱码的问题
来源:Linux社区 作者:frankfellow Linux下中文经常会出现乱码,有的是浏览网页出现乱码:有的是文本模式下显示中文出现乱码.下图显示的是我遇到的问题.我安装的是CentOS,x-w ...
- 只有文本编辑器才是王道, 什么ide都是evil的浮云, 看看linus linux的内核开发工具vim emacs
只有文本编辑器才是王道, 什么ide都是evil的浮云, 看看linus linux的内核开发工具vim emacs [ide is evil] (http://i.cnblogs.com/EditP ...
- What is the most common software of data mining? (整理中)
What is the most common software of data mining? 1 Orange? 2 Weka? 3 Apache mahout? 4 Rapidminer? 5 ...
- GOF业务场景的设计模式-----责任链模式
定义:使多个对象都有机会处理请求,从而避免了请求的发送者和接收者之间的耦合关系.将这些对象连成一条链,并沿着这条链传递该请求,直到有对象处理它为止. 首先来看一段代码: public void tes ...
- PHP读取excel文档
PHP读取excel文档 项目需要读取Excel的内容,从百度搜索了下,主要有两个选择,第一个是PHPExcelReader,另外一个是PHPExcel. PHPExcelReader比较轻量级, ...