java输入输出及文件_java输入输出流及文件操作
我只选择了一些代码
注意包声明和相关结构
许多类都继承了MyFile这个类
深入研究可以参考《java文件操作》
1.[代码]读取文件内容
/**
*Author:Yuanhonglong
*Date:2013-11-29
*1948281915
*/
package mine.file.Read_Write;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.io.Reader;
public class ReadFromFile{
static String tempString = null;
static String fileName = "C:/Users/Administrator/Desktop/mine/Result.txt";
public static void main(String[] args) {
System.out.println("以字节为单位读取文件内容,一次读一个字节:");
ReadFromFile.readFileByBytes(fileName);
System.out.println("以字符为单位读取文件内容,一次读一个字节:");
ReadFromFile.readFileByChars(fileName);
System.out.println("以行为单位读取文件内容,一次读一整行:");
ReadFromFile.readFileByLines(fileName);
System.out.println("随机读取一段文件内容:");
ReadFromFile.readFileByRandomAccess(fileName);
}
/**
* 以字节为单位读取文件,常用于读二进制文件,如图片、声音、影像等文件。
*/
public static void readFileByBytes(String fileName) {
File file = new File(fileName);
InputStream in = null;
try {
// 一次读一个字节
in = new FileInputStream(file);
int tempbyte;
while ((tempbyte = in.read()) != -1) {
System.out.write(tempbyte);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
try {
System.out.println("以字节为单位读取文件内容,一次读多个字节:");
// 一次读多个字节
byte[] tempbytes = new byte[100];
int byteread = 0;
in = new FileInputStream(fileName);
ReadFromFile.showAvailableBytes(in);
// 读入多个字节到字节数组中,byteread为一次读入的字节数
while ((byteread = in.read(tempbytes)) != -1) {
System.out.write(tempbytes, 0, byteread);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e1) {
}
}
}
}
/**
* 以字符为单位读取文件,常用于读文本,数字等类型的文件
*/
public static void readFileByChars(String fileName) {
File file = new File(fileName);
Reader reader = null;
try {
// 一次读一个字符
reader = new InputStreamReader(new FileInputStream(file));
int tempchar;
while ((tempchar = reader.read()) != -1) {
// 对于windows下,\r\n这两个字符在一起时,表示一个换行。
// 但如果这两个字符分开显示时,会换两次行。
// 因此,屏蔽掉\r,或者屏蔽\n。否则,将会多出很多空行。
if (((char) tempchar) != '\r') {
System.out.print((char) tempchar);
}
}
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
System.out.println("以字符为单位读取文件内容,一次读多个字节:");
// 一次读多个字符
char[] tempchars = new char[30];
int charread = 0;
reader = new InputStreamReader(new FileInputStream(fileName));
// 读入多个字符到字符数组中,charread为一次读取字符数
while ((charread = reader.read(tempchars)) != -1) {
// 同样屏蔽掉\r不显示
if ((charread == tempchars.length)
&& (tempchars[tempchars.length - 1] != '\r')) {
System.out.print(tempchars);
} else {
for (int i = 0; i < charread; i++) {
if (tempchars[i] == '\r') {
continue;
} else {
System.out.print(tempchars[i]);
}
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
}
/**
* 以行为单位读取文件,常用于读面向行的格式化文件
*/
public static void readFileByLines(String fileName) {
File file = new File(fileName);
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String tempString = null;
int line = 1;
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
// 显示行号
System.out.println("line " + line + ": " + tempString);
line++;
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
}
/**
* 随机读取文件内容
*/
public static void readFileByRandomAccess(String fileName) {
RandomAccessFile randomFile = null;
try {
// 打开一个随机访问文件流,按只读方式
randomFile = new RandomAccessFile(fileName, "r");
// 文件长度,字节数
long fileLength = randomFile.length();
// 读文件的起始位置
int beginIndex = (fileLength > 4) ? 4 : 0;
// 将读文件的开始位置移到beginIndex位置。
randomFile.seek(beginIndex);
byte[] bytes = new byte[10];
int byteread = 0;
// 一次读10个字节,如果文件内容不足10个字节,则读剩下的字节。
// 将一次读取的字节数赋给byteread
while ((byteread = randomFile.read(bytes)) != -1) {
System.out.write(bytes, 0, byteread);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (randomFile != null) {
try {
randomFile.close();
} catch (IOException e1) {
}
}
}
}
/**
* 显示输入流中还剩的字节数
*/
public static void showAvailableBytes(InputStream in) {
try {
System.out.println("当前字节输入流中的字节数为:" + in.available());
} catch (IOException e) {
e.printStackTrace();
}
}
}
2.[代码]写入文件
/**
*Author:Yuanhonglong
*Date:2013-12-14
*1948281915
*/
package mine.file.Read_Write;
import java.io.FileWriter;
import java.io.IOException;
import java.io.RandomAccessFile;
public class WriteToFile {
static String fileName = "C:/Users/Administrator/Desktop/mine/Result.txt";
static String contentA = "new append A!";
static String contentB = "new append B!";
/**
* A方法追加文件:使用RandomAccessFile
*/
public static void appendMethodA(String fileName, String content) {
try {
// 打开一个随机访问文件流,按读写方式
RandomAccessFile randomFile = new RandomAccessFile(fileName, "rw");
// 文件长度,字节数
long fileLength = randomFile.length();
//将写文件指针移到文件尾。
randomFile.seek(fileLength);
randomFile.writeBytes(content);
randomFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* B方法追加文件:使用FileWriter
*/
public static void appendMethodB(String fileName, String content) {
try {
//打开一个写文件器,构造函数中的第二个参数true表示以追加形式写文件
FileWriter writer = new FileWriter(fileName, true);
writer.write(content);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
//按方法A追加文件
System.out.println("按方法A追加文件内容:");
WriteToFile.appendMethodA(fileName, contentA);
WriteToFile.appendMethodA(fileName, "append A end. \r\n");
//显示文件内容
System.out.println("显示文件内容:");
ReadFromFile.readFileByLines(fileName);
//按方法B追加文件
System.out.println("按方法B追加文件内容:");
WriteToFile.appendMethodB(fileName, contentB);
WriteToFile.appendMethodB(fileName, "append B end. \r\n");
//显示文件内容
System.out.println("显示文件内容:");
ReadFromFile.readFileByLines(fileName);
}
}
3.[文件] MyFile.java ~ 351B 下载(13)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file;
public class MyFile {
public static String fileName = "C:/Users/Administrator/Desktop/mine/Result.txt";
public static String fileDir = "C:/Users/Administrator/Desktop/mine";
public static String fileDir2 = "C:/Users/Administrator/Desktop/mine/mine2";
}
4.[文件] Copy_File.java ~ 839B 下载(15)
/**
*Author:Yuanhonglong
*Date:2013-12-14
*1948281915
*/
package mine.file.copy;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import mine.file.MyFile;
public class Copy_File extends MyFile{
@SuppressWarnings({ "resource", "unused" })
public static void main(String[] args) throws IOException {
int bytesum=0;
int byteread=0;
File oldfile=new File(fileName);
if(oldfile.exists()){
FileInputStream inStream=new FileInputStream(oldfile);
File newfile=new File(fileDir2,oldfile.getName());
FileOutputStream fs=new FileOutputStream(newfile);
byte[] buffer=new byte[5120];
while((byteread=inStream.read(buffer))!=-1){
bytesum+=byteread;
fs.write(buffer,0,byteread);
}
inStream.close();
}
}
}
5.[文件] Creat_File.java ~ 740B 下载(15)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.create;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
public class Creat_File {
public static void main(String[] args) {
//新建文件
String fileName = "C:/Users/Administrator/Desktop/mine/Result.txt";
File myFilePath = new File(fileName);
try {
if (!myFilePath.exists()) {
myFilePath.createNewFile();
}
FileWriter resultFile = new FileWriter(myFilePath);
PrintWriter myFile = new PrintWriter(resultFile);
myFile.println(fileName);
myFile.flush();
resultFile.close();
}
catch (Exception e) {
System.out.println("新建文件操作出错");
e.printStackTrace();
}
}
}
6.[文件] Delete_Dir.java ~ 1KB 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.delete;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import mine.file.MyFile;
public class Delete_Dir extends MyFile {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void main(String[] args) {
LinkedList folderList = new LinkedList();
folderList.add(fileDir);
while (folderList.size() > 0) {
File file = new File((String) folderList.poll());
File[] files = file.listFiles();
ArrayList fileList = new ArrayList();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
folderList.add(files[i].getPath());
} else {
fileList.add(files[i]);
}
}
for (File f : fileList) {
f.delete();
}
}
folderList = new LinkedList();
folderList.add(fileDir);
while (folderList.size() > 0) {
File file = new File((String) folderList.getLast());
if (file.delete()) {
folderList.removeLast();
} else {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
folderList.add(files[i].getPath());
}
}
}
}
}
7.[文件] Delete_Dir_File.java ~ 1KB 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.delete;
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
public class Delete_Dir_File extends mine.file.MyFile{
//删除目录下所有文件,保留子目录和子目录下的文件
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.println("请输入您想删除的文件的路径:");
String filedir=s.next();
File delfilefolder=new File(filedir);
try {
if (delfilefolder.exists() && !delfilefolder.delete()){
File file = new File(filedir);
File[] files = file.listFiles();
ArrayList fileList = new ArrayList();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
} else {
fileList.add(files[i]);
}
}
for (int i=0;i
File ff=fileList.get(i);
ff.delete();
}
}
delfilefolder.mkdir();
}
catch (Exception e) {
System.out.println("清空目录操作出错");
e.printStackTrace();
}
}
}
8.[文件] Delete_File.java ~ 433B 下载(15)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.delete;
import java.io.File;
public class Delete_File extends mine.file.MyFile{
public static void main(String[] args) {
File myDelFile = new File(fileName);
try {
if(myDelFile.exists()){
myDelFile.delete();
}
}
catch (Exception e) {
System.out.println("ɾ³ýÎļþ²Ù×÷³ö´í");
e.printStackTrace();
}
}
}
9.[文件] GetProperties.java ~ 2KB 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-14
*1948281915
*/
package mine.file.list;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Date;
import mine.file.MyFile;
public class GetProperties extends MyFile {
public static void main(String[] args) {
//import java.io.*;
// 文件属性的取得
File f = new File(fileName);
if (f.exists()) {
System.out.println(f.getName() + "的属性如下:\n文件长度为:" + f.length());
System.out.println(f.isFile() ? "是文件" : "不是文件");
System.out.println(f.isDirectory() ? "是目录" : "不是目录");
System.out.println(f.canRead() ? "可读取" : "不可读取");
System.out.println(f.canWrite() ? "不是隐藏文件" : "是隐藏文件");
System.out.println("文件夹的最后修改日期为:" + new Date(f.lastModified()));
} else {
System.out.println(f.getName() + "的属性如下:");
System.out.println(f.isFile() ? "是文件" : "不是文件");
System.out.println(f.isDirectory() ? "是目录" : "不是目录");
System.out.println("不可读取");
System.out.println("文件的最后修改日期为:" + "无");
}
if(f.canWrite()){
String content="Yuanhonglong\r\n";
try {
//打开一个写文件器,构造函数中的第二个参数true表示以追加形式写文件
FileWriter writer = new FileWriter(fileName, true);
writer.write(content);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(f.canRead()){
File file = new File(fileName);
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String tempString = null;
int line = 1;
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
// 显示行号
System.out.println("line " + line + ": " + tempString);
line++;
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
}
}
}
10.[文件] Creat_Dir.java ~ 524B 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.create;
import java.io.File;
public class Creat_Dir {
public static void main(String[] args) {
//新建目录
String fileName = "C:/Users/Administrator/Desktop/mine";
File myFolderPath = new File(fileName);
try {
if (!myFolderPath.exists()) {
myFolderPath.mkdir();
System.out.println("Finish!");
}
}
catch (Exception e) {
System.out.println("新建目录操作出错");
e.printStackTrace();
}
}
}
11.[文件] List_All.java ~ 915B 下载(15)
/**
*Author:Yuanhonglong
*Date:2013-12-11
*1948281915
*/
package mine.file.list;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import mine.file.MyFile;
public class List_All extends MyFile {
//输出fileDir下所有文件和文件夹
public static void main(String[] args) {
LinkedList folderList = new LinkedList();
folderList.add(fileDir);
while (folderList.size() > 0) {
File file = new File(folderList.poll());
File[] files = file.listFiles();
List fileList = new ArrayList();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
folderList.add(files[i].getPath());
} else {
fileList.add(files[i]);
}
}
for (File f : fileList) {
file=f.getAbsoluteFile();
}
for(int aa=0;aa
System.out.println(files[aa]);
}
}
}
12.[文件] List_File_Dir.java ~ 1KB 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-15
*1948281915
*/
package mine.file.list;
import java.io.File;
import java.util.Scanner;
import mine.file.MyFile;
public class List_File_Dir extends MyFile{
private static String filter=null;
private static int n;
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.println("请输入查找目录:");
String filedir=s.next();
System.out.println("请输入要查找的文件或目录:");
filter=s.next();
doSearch(filedir);
System.out.println("The numbers of files had been found:"+n);
}
private static void doSearch(String path){
File file = new File(path);
if(file.exists()) {
if(file.isDirectory()) {
File[] fileArray = file.listFiles();
for(File f:fileArray) {
if(f.isDirectory()) {
if(f.getName().indexOf(filter) >= 0) {
System.out.println(f.getPath());
n++;
}
doSearch(f.getPath());
} else {
if(f.getName().indexOf(filter) >= 0) {
System.out.println(f.getPath());
n++;
}
}
f.getPath();
}
} else {
System.out.println("Couldn't open the path!");
}
} else {
System.out.println("The path had been apointed was not Exist!");
}
}
}
13.[文件] SetProperties.java ~ 354B 下载(15)
/**
*Author:Yuanhonglong
*Date:2013-12-14
*1948281915
*/
package mine.file.list;
import java.io.File;
import mine.file.MyFile;
public class SetProperties extends MyFile {
public static void main(String[] args) {
File file=new File(fileName);
file.setReadOnly();
file.setReadable(true);
file.setWritable(true);
}
}
14.[文件] Move_File.java ~ 1KB 下载(13)
/**
*Author:Yuanhonglong
*Date:2013-12-14
*1948281915
*/
package mine.file.move;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;
import mine.file.MyFile;
public class Move_File extends MyFile {
@SuppressWarnings({ "resource", "unused" })
public static void main(String[] args) throws IOException {
int bytesum=0;
int byteread=0;
Scanner s=new Scanner(System.in);
System.out.println("请输入您想移动的文件路径:");
String filed=s.next();
System.out.println("请输入您想移动到的文件目录:");
String filedir=s.next();
File oldfile=new File(filed);
if(oldfile.exists()){
FileInputStream inStream=new FileInputStream(oldfile);
File newfile=new File(filedir,oldfile.getName());
FileOutputStream fs=new FileOutputStream(newfile);
byte[] buffer=new byte[5120];
while((byteread=inStream.read(buffer))!=-1){
bytesum+=byteread;
fs.write(buffer,0,byteread);
}
inStream.close();
oldfile.delete();
}
}
}
15.[文件] OutStream.java ~ 1KB 下载(15)
package mine.file.Read_Write;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class OutStream {
/**
Author:Yuanhonglong
Date:2013-11-18
*/
public static void main(String[] args) {
OutputStream os = null;
FileOutputStream liu = null;
String Kongge ="Yuanhonglong"; //流对象Kongge
try {
os = new FileOutputStream("C:/Users/Administrator/Desktop/mine/Result.txt");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
liu = new FileOutputStream("C:/Users/Administrator/Desktop/mine/Result.txt",true); //创建流对象
byte[] b1 = Kongge.getBytes(); //转换为byte数组
liu.write(b1); //写入
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
try{
liu.close();
}catch(Exception e){}
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
16.[文件] Prime_output.java ~ 2KB 下载(15)
package mine.file.Read_Write;
/*
Author:Yuanhonglong
Date:2013-11-18
*/
//熟悉java输入输出
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileOutputStream;
public class Prime_output{
@SuppressWarnings("resource")
public static void main(String args[]) throws IOException{
System.out.println("本软件用于求大于1小于N的素数");
java.io.InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("请输入正整数N(保证N大于2且小于2的31次方减1):");
String str = null;
str = br.readLine();
int N = Integer.parseInt(str);
int n=0;
FileOutputStream liu = null; //声明流对象
liu = new FileOutputStream("C:/Users/Administrator/Desktop/mine/Result.txt",true); //创建流对象
outer:for(int i=2;i
int k=(int) Math.sqrt(i);
for(int j=2;j<=k;j++){
if(i%j==0&&i>j)
continue outer;
}
String ss=" "+i;
System.out.print(ss);
byte[] b2 =ss.getBytes(); //转换为byte数组
liu.write(b2); //写入
n++;
if(n<16) continue outer; //因为前边出现过"continue outer;"此处"outer"可以承前省略
System.out.println();//此命令一般用于换行
n=0;
}
}
}
/*
*n的作用:可以看出,每产生一个结果,n就加1,一旦n等于8,则执行换行命令且n归零,
*此后又产生8个结果n又归零,也就是说每一行只显示8个结果
*/
17.[文件] Url.java ~ 869B 下载(14)
package mine.file.Read_Write;
import java.net.*;
import java.io.*;
/*
Author:Yuanhonglong
*/
public class Url
{
public static void main(String[] args)
{
String urlname = "http://127.0.0.1:8080/TravelRequest/TravelRequest.html"; //修改地址,查看其源文件
if (args.length>0) urlname=args[0];
new Url().display(urlname);
}
public void display(String urlname)
{
try
{
URL url=new URL(urlname); //创建URL类对象url
InputStreamReader in=new InputStreamReader(url.openStream());
BufferedReader br=new BufferedReader(in);
String aLine;
while((aLine=br.readLine())!=null) //从流中读取一行显示
System.out.println(aLine);
}
catch(MalformedURLException murle)
{ System.out.println(murle); }
catch(IOException ioe)
{ System.out.println(ioe); }
}
}
18.[文件] RedirectOutputStream.java ~ 608B 下载(14)
/**
*Author:Yuanhonglong
*Date:2013-12-9
*1948281915
*/
package mine.file.Read_Write;
import java.io.FileNotFoundException;
import java.io.PrintStream;
public class RedirectOutputStream {
//重定向输出流
public static void main(String[] args) {
try{
PrintStream out=System.out;
PrintStream ps=new PrintStream("./src/mine/file/Read_Write/log.txt");
System.setOut(ps);
int age=18;
System.out.println("Age:"+age);
System.setOut(out);
//恢复标准输出流
System.out.println("运行日志");
}catch(FileNotFoundException e){
e.printStackTrace();
}
}
}
java输入输出及文件_java输入输出流及文件操作相关推荐
- java文件流写入文件_JAVA 输入输出流 本地文件读写
今天学了一下Java的文件的读写. 流名为什么名字都这么长???? 这让我咋么记? 今天我想实现的功能是基本的文件操作,从输入in文件里读取数据,然后程序处理之后输出到out输出文件中,以助于ACM中 ...
- java中nio流_Java输入输出流IO介绍(与NIO比较)
一.Java中流的类型 根据流的方向划分:输入流,输出流 根据流的传输单位:字节流,字符流 根据流的角色划分:节点流,处理流 节点流:直接连接数据源的流 处理流:通过构造方法接收一个节点流,对节点流使 ...
- java 对象读写_java 对象输入输出流读写文件的操作实例
java 对象输入输出流读写文件的操作实例 java 支持对对象的读写操作,所操作的对象必须实现Serializable接口. 实例代码: package vo; import java.io.Ser ...
- java用输入流创建数据文件_java开发知识IO知识之输入输出流以及文件
java开发知识IO知识之输入输出流以及文件 一丶流概述 流十一组有序的数据序列.根据操作的类型,可以分为输入流跟输出流两种. IO(input/output)输入/输出流提供了一条通道程序.可以使用 ...
- Java基础知识每日总结(19)---Java输入输出流、文件、递归
输入输出流.文件.递归 在变量.数组和对象中存储数据是暂时的,程序结束后它们则会丢失.为了能够永久地保存程序创建的数据,需要将其保存在磁盘文件中.这样以后就可以在其他程序中使用它们.Java的I/O技 ...
- 【Java学习笔记十】输入输出流
在Java.io包中提供了一系列用于处理输入/输出的流类.从功能上分为两类:输入流和输出流.从六结构上可分为:字节流(以字节为处理单位)和字符流(以字符为处理单位). 字符是由字节组成.在Java中所 ...
- 利用输入输出流及文件类编写一个程序,可以实现在屏幕显示文本文件的功能,类似DOS命令中的type命令
利用输入输出流及文件类编写一个程序,可以实现在屏幕显示文本文件的功能,类似DOS命令中的type命令 package p1;import java.io.BufferedReader; import ...
- Java中IO流,输入输出流概述与总结(转载自别先生文章)
Java中IO流,输入输出流概述与总结 总结的很粗糙,以后时间富裕了好好修改一下. 1:Java语言定义了许多类专门负责各种方式的输入或者输出,这些类都被放在java.io包中.其中, 所有输入流类都 ...
- c语言 文件流 输出数据类型,总结C++中输入输出流及文件流操作
当程序员在编写程序的时候,最不可分割的是对文件做的相应的操作,总结C++中输入输出流及文件流操作大家都了解吗?想要了解的朋友,就随爱站技术频道小编来看看吧. 1.流的控制 iomanip ...
最新文章
- UI设计师的实际工作流程是什么样的?
- TCP 三次握手与四次挥手
- Hadoop的版本介绍
- SAP CRM WebClient UI交互式报表的Gross Value工作原理
- c语言从html控件sscanf,sscanf与sprintf在C语言中的用法
- ningx修改mysql数据库密码_windows下面的php+mysql+nginx
- (17)HTML标准文档流
- OpenLayers WFS指定地理范围查询
- Web Hacking 101 中文版 六、HTTP 参数污染
- Java实现查看SEGY(.su格式)数据道头字信息的GUI图形用户界面
- C++:如何在VS中配置第三方动态库 【visual Studio 2017 + Opencv 】
- 软件测试中英文词汇对照表
- JNI 本地方法注册
- 计算机画图工具介绍PPT,怎么用思维导图制作PPT课件,迅捷画图软件讲解
- matlab人口增长线性回归拟合_科学网—matlab线性拟合 - 张瑞龙的博文
- 智能手机和平板电脑设计中的单键开/关机和复位的智能方案
- 企业正确导入BPM系统要注意什么
- Android UI自动化工具-SoloPi
- ASP.NET项目创建
- 解决Solaris应用程序开发内存泄漏问题
热门文章
- list存入mysql乱序_MySQL案例-并行复制乱序提交引起的同步异常
- R语言ggplot2可视化箱图(boxplot)并使用ggsignif添加分组显著性(significance)标签
- R语言ggplot2可视化数据点注释、标签显示不全、发生边界截断问题解决实战
- R语言dir函数获取目录中文件或者文件夹名称实战
- 自动编码(Autoencoder)器异常检测(outlier detection)实战
- 影像组学视频学习笔记(35)-基于2D超声影像的影像组学特征提取、Li‘s have a solution and plan.
- 第二章 实验设计的考虑因素
- ReSimNet: drug response similarity prediction using Siamese neural networks
- An Error Correction and DeNovo Assembly Approach for Nanopore Reads Using Short Reads
- TensorFlow基础1(波士顿房价/鸢尾花数据集可视化)