java Io测试
package com.Test.Demo.Test;
import java.io.*;
import java.util.Scanner;
public class IoTest {
public static void main(String[] args) throws IOException {
/*File file = new File("E:\\Debug\\12345\\111.txt");
File file1= new File("E:\\Debug\\12345\\222.txt");
//文件字节输入输出流
InputStream inputStream = new FileInputStream(file1);
OutputStream stream = new FileOutputStream(file,true); //追加写入
*//*int b = 0;
while((b=inputStream.read())!=-1){
stream.write(b);
}*//*
byte[] bytes1 = new byte[10244];
inputStream.read(bytes1);
stream.write(bytes1);
String string = "\n13dwdsdsd";
byte[] bytes = string.getBytes();
stream.write(bytes);
stream.flush();
inputStream.close();
stream.close();
//文件字符输入输出流
Writer writer = new FileWriter("E:\\Debug\\12345\\444.txt",true);
Reader reader = new FileReader("E:\\Debug\\12345\\222.txt");
char[] chars = new char[1000];
reader.read(chars);
writer.write(chars);
writer.flush();
reader.close();
writer.close();*/
//打印字节流
// PrintStream printStream = new PrintStream(new FileOutputStream("E:\\Debug\\12345\\444.txt"));
//今后在输出时,都可以用打印流输出
// Scanner scanner = new Scanner(new FileInputStream("E:\\Debug\\12345\\444.txt"));
// PrintWriter pri = new PrintWriter(new FileWriter("E:\\Debug\\12345\\124.txt"));
// scanner.useDelimiter("\n");
// while(scanner.hasNext()){
// String st=scanner.next();
// pri.print(st);
// }
// pri.flush();
// pri.close();
/*pri.println(1213);
pri.println("sfsdffs");
pri.print(new A());*/
//以后读带有空格的数据,可以用以下的格式读取
/* BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String s=bufferedReader.readLine();
System.out.println(s);
int t = Integer.parseInt(s);
System.out.println(t);
bufferedReader.close();*/
//以后读不带空格的 扫描流最方便 也可以设置分隔符
Scanner scanf = new Scanner(System.in);
scanf.useDelimiter("\n");
String t= scanf.next();
System.out.print(t);
}
}