⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createtxt.java

📁 java生成txt文件.将结果集生成一个txt文件。
💻 JAVA
字号:
package com.width.test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class CreateTxt {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
//		long start = System.currentTimeMillis();
//		CreateTxt.create();
//        long end = System.currentTimeMillis();
//        System.out.println("耗时:"+(end-start)+"ms");
		CreateTxt.del();
	}
	public static void create() throws IOException{
		FileOutputStream fos = new FileOutputStream("e:/test.txt");
		String test = "this is a test case for 10W.\r\n";
		for(int i=0;i<100000;i++){
		    fos.write(test.getBytes());
		}
        fos.close();
	}
	public static void del(){
		File file = new File("e:/test.txt");
		file.delete();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -