上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: package string.itcastio;import java.io.*;/* * 打印流 * 该流提供了打印方法,可以将各种数据类型的数据都原样打印 * 字节打印流 * PrintStream * 构造函数可以接收的参数类型 * 1,file对象。File * 2,字符串路径。String * 3,字节输出流 。OutputStream * 字符串打印 * PrintWriter * 构造函数可以接收的参数类型 * 1,file对象。File * 2,字符串路径:String * 3,字节输出流: OutputStream * 4,字符输出流:Writer * */public c. 阅读全文
posted @ 2013-03-25 11:32 谷文仁 阅读(158) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.util.*;import java.io.*;/* * 练习 * 将一个指定目录下的java文件的绝对路径,存储到一个文本文件中 * 建立一个java文件列表文件 * 思路 * 1,对指定文件目录经行递归 * 2,获取递归过程中所有文件的路径 * 3,将这些路径存储到集合中 * 4,将集合中的数据写入到一个文件中 * */public class JavaFileList { public static void main(String[] args) { File file = new File(... 阅读全文
posted @ 2013-03-25 11:19 谷文仁 阅读(173) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.io.File;/* * 列出指定目录下文件或者文件夹,包含子目录中的内容 * 也就是列出目录下所有内容 * 因为目录中还有目录,只要使用同一个列出目录功能的函数完成即可 * 在列出过程中出现的还是目录的话,还可以再次调用本功能 * 也就是函数自身调用自身。 * 这种表现形式,或者编程手法,称为递归。 * 递归要注意: * 1.限定条件 * 2.要注意递归的次数。尽量避免内存溢出。 */public class FileDemo3 { public static void main(String[] args) { ... 阅读全文
posted @ 2013-03-25 10:47 谷文仁 阅读(165) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.io.File;import java.io.FilenameFilter;/* * String[] list() 返回一个字符串数组,这些字符串指定此抽象路径名表示的目录中的文件和目录。 * String[] list(FilenameFilter filter) 返回一个字符串数组,这些字符串指定此抽象路径名表示的目录中满足指定过滤器的文件和目录。 * File[] listFiles() 返回一个抽象路径名数组,这些路径名表示此抽象路径名表示的目录中的文件。 * File[] listFiles(FileFilt. 阅读全文
posted @ 2013-03-25 10:10 谷文仁 阅读(146) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.io.*;/* * 字符流 * 1,FileReader * 2,FileWriter * 3,BufferedReader * 4,BufferedWriter * 字节流 * 1,InputStream * 2,OutputStream * 3,BufferedInputStream * 4,BufferedOutputStream * * OutputStreamWriter: * 是字符流通向字节流的桥梁... 阅读全文
posted @ 2013-03-23 14:48 谷文仁 阅读(149) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.io.*;/* * 字符流 * 1,FileReader * 2,FileWriter * 3,BufferedReader * 4,BufferedWriter * 字节流 * 1,InputStream * 2,OutputStream * 3,BufferedInputStream * 4,BufferedOutputStream * * InputStreamReader: * 是字节流通向字符流的桥梁 ... 阅读全文
posted @ 2013-03-23 14:28 谷文仁 阅读(139) 评论(0) 推荐(0) 编辑
摘要: package string.itcastio;import java.io.*;/* * 当录入一行数据后,就将该行数据经行打印 * 如果录入的数据是over,那么停止录入 */public class IODemo1 { public static void main(String[] args) throws IOException { InputStream is = System.in; StringBuilder sb = new StringBuilder(); while (true) { int ch = ... 阅读全文
posted @ 2013-03-23 14:15 谷文仁 阅读(133) 评论(0) 推荐(0) 编辑
摘要: package string.test;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;/* * * 复制一个图片 * 思路: * 1,用字节读取流对象和图片关联 * 2,用字节写入流对象创建一个图片文件。用于存储获取到的图片数据 * 3,通过循环读写,完成数据的存储 * 4,关闭资源 */public class CopePic { /** ... 阅读全文
posted @ 2013-03-22 13:27 谷文仁 阅读(157) 评论(0) 推荐(0) 编辑
摘要: package string.test;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;/* * 字符流 * FileReader * FileWriter * * BufferedReader * BufferedWriter * 字节流 * InputStream OutputStream * */public class InputStreamDemo { /** * @param args * @throws IOExceptio... 阅读全文
posted @ 2013-03-22 12:54 谷文仁 阅读(215) 评论(0) 推荐(0) 编辑
摘要: package string.test;import java.io.BufferedWriter;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.LineNumberReader;import java.io.Reader;/* * LineNumberReader * 跟踪行号的缓冲字符输入流。此类定义了方法 setLineNumber(int) 和 getLineNumber(),它们可分别用于设置和获取当前行号。 */public cla... 阅读全文
posted @ 2013-03-22 09:54 谷文仁 阅读(207) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页