Commit 37fb8482 authored by liml's avatar liml

git 测试

parents
Pipeline #316 canceled with stages
package com.caiyang.li.util;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;
public class ScannerDemo {
/**
* 通过控制台输出文本
*/
public void FileStream(){
Scanner scanner = new Scanner(System.in);
System.out.println("nextLine方式接收:");
if (scanner.hasNextLine()){
String line = scanner.nextLine();
System.out.println("输入数据"+line);
ScannerDemo scannerDemo = new ScannerDemo();
this.Filelist(line.getBytes());
}
scanner.close();
}
public void Filelist(byte bWrite[]){
File file = new File("C:/text.txt");
try {
FileOutputStream stream = new FileOutputStream(file,true);
for (int i=0;i<bWrite.length;i++){
stream.write(bWrite[i]);
}
stream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment