这里写目录标题
- Java IO
- 1.创建文件的3种方式
- 2.获取文件的信息
- 3.目录操作
- 4.FileInputStream
- 5.FileOutputStream
- 6.文件拷贝
- 7.FileReader
- 8.FileWriter
- 9.BufferedReader
- 10.BufferedWriter
- 11.BufferedCopy
- 12.BufferedOutputStream 和 BufferedInputStream(字节流处理文件拷贝)
- 13.ObjectOutStreeam(序列化)
- 14.ObjectInputStream(反序列化)
- 15.标准输入流与输出流
- 16.乱码引出转换流
- 17.解决乱码(转换流InputStreamReader)
- 18.OutputStreamWriter指定编码
- 19.PrintStream(打印流)
- 20.PrintWriter(字符打印流)
- 21.配置文件引出Properties
- 22.Properties读取文件
- 23.Properties修改文件
Java IO
1.创建文件的3种方式
package javaio.file;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
public class FileCreate {
//方式1 new File(String pathname)
@Test
public void create01(){
String filePath = "E:\\文件下载\\news1.txt";
File file = new File(filePath);
try {
file.createNewFile();
System.out.println("文件创建成功");
} catch (IOException e) {
e.printStackTrace();
}
}
//方式2 new File(File parent, String child) //根据父目录文件 + 子路劲构建
//E:\文件下载\news2.txt
@Test
public void create02(){
File parentFile = new File("E:\\文件下载");
String fileName = "news2.txt";
//这里的file对象,在java程序中,只是一个对象
//只有执行了createNewFile 方法,才会真正的,在磁盘创建该文件
File file = new File(parentFile,fileName);
try {
file.createNewFile();
System.out.println("文件创建成功");
} catch (IOException e) {
e.printStackTrace();
}
}
//方法3 new File(String parent, String child) //根据父目录文件 + 子路劲构建
@Test
public void create03(){
String parentFile = "E:\\文件下载";
String fileName = "news3.txt";
File file = new File(parentFile,fileName);
try {
file.createNewFile();
System.out.println("文件创建成功");
} catch (IOException e) {
e.printStackTrace();
}
}
}
2.获取文件的信息
//获取文件的信息
@Test
public void ionfo(){
File file = new File("E:\\文件下载\\news1.txt");
//通用相应的方法,得到对应信息
System.out.println("文件名字=" + file.getName());
System.out.println("文件绝对路劲=" + file.getAbsolutePath());
System.out.println("文件父级目录=" +file.getParent());
System.out.println("文件大小(字节)=" + file.length());
System.out.println("文件是否存在=" +file.exists());//T
System.out.println("是不是一个文件=" + file.isFile());//T
System.out.println("是不是一个目录="+ file.isDirectory());//F
}
3.目录操作
//判断 E:\文件下载\news1.txt 是否存在,如果存在就删除
@Test
public void m1(){
String filePath = "E:\\文件下载\\news1.txt";
File file = new File(filePath);
if(file.exists()){
if(file.delete()){
System.out.println(filePath + "删除成功");
}else {
System.out.println(filePath + "删除失败");
}
}else {
System.out.println(filePath +"该文件不存在...");
}
}
//判断 E:\新建文件夹 是否存在,存在就删除,否则提示不存在
//这里我们需要体会到,在java编程中,目录也被当做文件
@Test
public void m2(){
String filePath = "E:\\新建文件夹";
File file = new File(filePath);
if(file.exists()){
if(file.delete()){
System.out.println(filePath + "删除成功");
}else {
System.out.println(filePath + "删除失败");
}
}else {
System.out.println(filePath +"该目录不存在...");
}
}
//判断 E:\文件下载\a\b\c 目录是否存在,如果存在就提示已经存在,否则就创建
@Test
public void m3() {
String diectoryPath = "E:\\文件下载\\a\\b\\c";
File file = new File(diectoryPath);
if (file.exists()) {
System.out.println(diectoryPath + "存在..");
} else {
if(file.mkdirs()) {
System.out.println(diectoryPath + "创建成功...");
} else {
System.out.println(diectoryPath + "创建失败...");
}
}
}
4.FileInputStream
package javaio.inputStream;
import org.junit.Test;
import java.io.FileInputStream;
import java.io.IOException;
public class FileInputStream1Test {
/**
* 读取文件
* 单个字节的读取,效率比较低
*/
@Test
public void readFile01(){
String filePath = "E:\\文件下载\\h.txt";
int readData = 0;
FileInputStream fileInoutStream = null;
try {
//创建 FileInputStream 对象,用于读取 文件
fileInoutStream= new FileInputStream(filePath);
//从该输入流读取一个字节的数据, 如果没有输入可用,此方法将阻止。
//如果返回-1 ,表示读取完毕
while ((readData = fileInoutStream.read()) != -1){
System.out.print((char)readData);//转成char显示
}
} catch (IOException e) {
e.printStackTrace();
}finally {
//关闭文件流,释放资源
try {
fileInoutStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 使用read(byte[] b) 读取文件,提高效率
*/
@Test
public void readFile02(){
String filePath = "E:\\文件下载\\h.txt";
//字节数组
byte[] buf = new byte[8];//一次读取8个字节
int readLen = 0;
FileInputStream fileInoutStream = null;
try {
//创建 FileInputStream 对象,用于读取 文件
fileInoutStream= new FileInputStream(filePath);
//从该输入流读取最多b.length字节的数据到字节数组。此方法将阻塞,直到某些输入可用
//如果返回-1 ,表示读取完毕
//如果读取正常,返回实际读取的字节树
while ((readLen = fileInoutStream.read(buf)) != -1){
System.out.print(new String(buf,0,readLen));//转成char显示
}
} catch (IOException e) {
e.printStackTrace();
}finally {
//关闭文件流,释放资源
try {
fileInoutStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
5.FileOutputStream
package javaio.outputstream;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileOutStreamTest {
/**
* 使用FileOutStream 将数据写到文件中
* 如果该文件不存在,则创建改文件
*/
@Test
public void writeFile(){
//创建 FileOutStream 对象
String filePath = "E:\\文件下载\\a.txt";
FileOutputStream fileOutputStream = null;
try {
//得到 FileOutputStream对象
//1.new FileOutputStream(filePath) 创建方式,当写入内容是,会覆盖原来的内容
//2.new FileOutputStream(filePath,true) 创建方式,当写入内容是,是追加到文件后面
fileOutputStream = new FileOutputStream(filePath,true);
//写人一个字节
//fileOutputStream.write('H');
//写人字符串
String str = "hello,world!";
//str.getBytes() 可以把字符串 -> 字节数组
//fileOutputStream.write(str.getBytes());
//write(byte b[], int off, int len) 将 len字节从位于偏移量 off的指定字节数组写入此文件输出流
fileOutputStream.write(str.getBytes(),0,str.length());
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
6.文件拷贝
package javaio.outputstream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileCopy {
public static void main(String[] args){
//完成 文件拷贝,将 E:\文件下载\a.txt 拷贝 E:\文件下载\新建文件夹
//1.创建文件的输入流,将文件读入到程序
//2.创建文件的输入流, 将读取的文件数据,写入到指定的文件。
String srcfilePath = "C:\\Users\\86157\\Pictures\\Saved Pictures\\微信图片_20221125105453.jpg";
String destFPath = "E:\\文件下载\\新建文件夹\\微信图片_20221125105453.jpg";
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
try {
fileInputStream = new FileInputStream(srcfilePath);
fileOutputStream = new FileOutputStream(destFPath);
//定义一个字节数组,提高读取效果
byte[] buf = new byte[1024];
int readLen = 0;
while ((readLen = fileInputStream.read(buf))!= -1){
//读取到最后,就写入到文件 通过 fileOutputStream
//即,是一边读,一边写
fileOutputStream.write(buf,0,readLen);//一定要使用这个方法
}
System.out.println("拷贝ok");
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if (fileInputStream != null){
fileInputStream.close();
}
if (fileOutputStream != null){
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
7.FileReader
方式1
/**
* 单个字符读取文件
*/
public static void main(String[] args){
String filePath = "E:\\文件下载\\d.txt";
FileReader fileReader = null;
int data = 0;
//1.创建FileReader对象
try {
fileReader = new FileReader(filePath);
//循环读取使用read,单个字符读取
while ((data = fileReader.read()) != -1){
System.out.print((char) data);
}
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
方式2
/**
* 字符数组读取文件
*/
@Test
public void ReadFile02() {
String filePath = "E:\\文件下载\\d.txt";
FileReader fileReader = null;
int readLen = 0;
char[] buf = new char[8];
//1.创建FileReader对象
try {
fileReader = new FileReader(filePath);
//循环读取使用read(buf),返回的是实际读取到的字符数
//如果返回-1,说明到文件结束
while ((readLen = fileReader.read(buf)) != -1) {
System.out.print(new String(buf, 0, readLen));
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
8.FileWriter
package javaio.writer;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class FileWriterTest {
public static void main(String[] args) {
String filePath = "E:\\文件下载\\y.txt";
FileWriter fileWriter = null;
char[] chars = {'y','y','c'};
//1.创建FileReader对象
try {
fileWriter = new FileWriter(filePath);//默认是覆盖写入
//1.write(int);写入单个字符
fileWriter.write("YYC");
//2.write(cbuf[]);写入指定数组
fileWriter.write(chars);
//3.write(char cbuf[], int off, int len);写入指定数组的指定部分
fileWriter.write("大大撒旦请问去".toCharArray(),0,3);
//4.write(String);写入整个字符串
fileWriter.write("我去打球打球的是");
//5.write(String str, int off, int len);写入整个字符串的指定部分
fileWriter.write("打球的青蛙大全",0,2);
//在数据量大的情况下,可以使用循环操作。
} catch (IOException e) {
e.printStackTrace();
} finally {
//对于FileWriter,一定要关闭流,或者flush才能真正的把数据写入到文件
try {
fileWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("程序结束");
}
}
9.BufferedReader
package javaio.reader;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
* 适用于读取文件,不试用于读二进制eg:图片
*/
public class BufferedReaderTest {
public static void main(String[] args) throws IOException {
String filePath = "E:\\文件下载\\d.txt";
//创建bufferedReader
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
String line;//按行读取,效率高
//1.bufferedReader.readLine 是按行读取文件
//2.当返回null时,表示文件读取完毕
while ((line = bufferedReader.readLine()) != null){
System.out.println(line);
}
//关闭流,这里注意,只需要关闭 BufferedReader ,因为底层会自动的去关闭 节点流
//FileReader
bufferedReader.close();
}
}
10.BufferedWriter
package javaio.writer;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class BufferedWriterTest {
public static void main(String[] args) throws IOException {
String filePath ="E:\\文件下载\\y.txt";
//1.(new FileWriter(filePath,true) 表示以追加的方式写入
//2.(new FileWriter(filePath) 表示以覆盖的的方式写入
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath,true));
bufferedWriter.write("v啊v阿飞");
bufferedWriter.newLine();
bufferedWriter.write("合法i是否会");
bufferedWriter.newLine();
bufferedWriter.write("dasdasd");
bufferedWriter.newLine();
//说明:关闭外层流即可, 传入 new FileWriter(filePath) ,会在底层关闭
bufferedWriter.close();
}
}
11.BufferedCopy
package javaio.writer;
import java.io.*;
public class BufferedCopyTest {
public static void main(String[] args) throws IOException {
//1.BufferedReader 和 BufferedWriter 是安装字符操作
//不要去操作 二进制文件【声音,视频,doc,pdf,等等】,可能造成文件损坏
String srcFilePath = "E:\\文件下载\\d.txt";
String desFilePath = "E:\\文件下载\\y.txt";
String line;
BufferedReader bufferedReader = new BufferedReader(new FileReader(srcFilePath));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(desFilePath));
while ((line = bufferedReader.readLine()) != null){
//每读取一行,就写入
bufferedWriter.write(line);
//插入一个换行
bufferedWriter.newLine();
}
System.out.println("拷贝完成");
//关闭流
if(bufferedReader !=null){
bufferedReader.close();
}
if(bufferedWriter !=null){
bufferedWriter.close();
}
}
}
12.BufferedOutputStream 和 BufferedInputStream(字节流处理文件拷贝)
package javaio.inputStream;
import java.io.*;
/**
* 使用BufferedOutputStream 和 BufferedInputStream
* 使用它们,可以完成二进制文件拷贝
* 字节流也可以操作文本文件
*/
public class BufferedCopy02 {
public static void main(String[] args) throws IOException {
String srcFilePath = "E:\\文件下载\\新建文件夹\\微信图片_20221125105453.jpg";
String desFilePath = "E:\\文件下载\\ddd.jpg";
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
bis = new BufferedInputStream(new FileInputStream(srcFilePath));
bos = new BufferedOutputStream(new FileOutputStream(desFilePath));
//循环的读取文件,并写入到 desFilePath
byte[] buff = new byte[1024];
int readLen = 0;
//当返回 -1 时,就表示文件读取完毕
while ((readLen = bis.read(buff)) != -1){
bos.write(buff,0,readLen);
}
System.out.println("拷贝完成");
//关闭流, 关闭外层的处理流即可, 底层会去关闭节点流
if(bis !=null){
bis.close();
}
if(bos !=null){
bos.close();
}
}
}
13.ObjectOutStreeam(序列化)
package javaio.outputstream;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* 使用ObjectOutStreeam,完成数据的序列化
*/
public class ObjectOutStreeamTest {
public static void main(String[] args) throws Exception {
//序列化后,保存的文件格式,不是存文本, 而是按照它的格式来保存
String filePath = "E:\\文件下载\\data.dat";
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
//序列化数据到 E:\文件下载\data.dat
oos.writeInt(100);//int ->Integer(实现了 Serializable)
oos.writeBoolean(true);//boolean ->Boolean(实现了 Serializable)
oos.writeChar('a');//char ->Character(实现了 Serializable)
oos.writeDouble(6.5);//double ->Double(实现了 Serializable)
oos.writeUTF("发觉发生");//Sting (实现了 Serializable)
//保存一个dog对象
oos.writeObject(new Dog("小黑子",6));
oos.close();
System.out.println("数据保存完毕(序列化形式)");
}
}
//如果需要序列化某个类的对象, 实现Serializable
class Dog implements Serializable{
private String name;
private int age;
public Dog(String name, int age) {
this.name = name;
this.age = age;
}
}
14.ObjectInputStream(反序列化)
package javaio.inputStream;
import javaio.outputstream.Dog;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class ObjectInputStreamTest{
public static void main(String[] args) throws IOException, ClassNotFoundException {
//指定反序列的文件
String filePath = "E:\\文件下载\\data.dat";
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath));
//1.读取(反序列化)的顺序需要和你保存数据(序列化)的顺序一致,否则会出现异常
System.out.println(ois.readInt());
System.out.println(ois.readBoolean());
System.out.println(ois.readChar());
System.out.println(ois.readDouble());
System.out.println(ois.readUTF());
Object dog = ois.readObject();
System.out.println("运行类型=" + dog.getClass());
//序列化文件对象一定运行toString方法
System.out.println("dog信息=" + dog);//底层 Object -> Dog
//重要的细节:
//1.如果我们希望调用Dog的方法,需要向下转型
//2.需要我们将Dog类的定义,拷贝到可以引用的位置
//3.把Dog类变成公共的类
Dog dog2 = (Dog)dog;
System.out.println(dog2.getName());
//关闭流,关闭外层流即可,底层会关闭 FileInputStream 流
ois.close();
}
}
15.标准输入流与输出流
package javaio.standaed;
import java.util.Scanner;
public class InputAndOutput {
public static void main(String[] args){
//System 类 的 public final static InputStream in = null;
//System.in 编译类型 InputStream
//System.in 运行类型 BufferedInputStream
System.out.println(System.in.getClass());
//1.public final static PrintStream out = null;
//2.编译类型 PrintStream
//3.运行类型 PrintStream
//4.表示标准输出 显示器
System.out.println(System.out.getClass());
System.out.println("小黑子");
Scanner scanner = new Scanner(System.in);
System.out.println("输入");
String next = scanner.next();
System.out.println("next=" + next);
}
}
16.乱码引出转换流
package javaio.transformation;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class CodeQuestion {
public static void main(String[] args) throws IOException {
//读取E:\文件下载\y.txt 文件到程序
//1. 创建字符流输入流 BufferedReader [处理流]
//2. 使用 BufferedReader 对象读取y.txt
//3.默认情况下,读取文件是按照 utf-8 编码
//把E:\文件下载\y.txt文件改成国标码中文会乱码 ANSI
String filePath = "E:\\文件下载\\y.txt";
BufferedReader br = new BufferedReader(new FileReader(filePath));
String s = br.readLine();
System.out.println("读取到内容: " + s);
br.close();
}
}
17.解决乱码(转换流InputStreamReader)
package javaio.transformation;
import java.io.*;
/**
* 使用 InputStreamReader 转换流解决中文乱码问题
* 将字节流 FileInputStream 转成字符流 InputStreamReader,指定编码 gbk/utf-8
*/
public class InputStreamReaderTest {
public static void main(String[] args) throws IOException {
String filePath = "E:\\文件下载\\y.txt";
//1. 把 FileInputStream 转成 InputStreamReader
//2. 指定编码 gbk
// InputStreamReader isr = new InputStreamReader(new FileInputStream(filePath),"gbk");
// BufferedReader br = new BufferedReader(isr);
//将2 和3 合在一起
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath),"gbk"));
//4.读取
String s = br.readLine();
System.out.println("读取到的内容" + s);
br.close();
}
}
18.OutputStreamWriter指定编码
package javaio.transformation;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
/**
* OutputStreamWriter 使用
* 把FileOutputStream 字节流, 转成字符流 OutputStreamWriter
* 指定处理的编码 gbk/utf-8/utf8
*/
public class OutputStreamWriterTest {
public static void main(String[] args) throws IOException {
String filePath = "E:\\文件下载\\yy.txt";
String charSet = "gbk";
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filePath),charSet);
osw.write("ikun,小黑子");
osw.close();
System.out.println("按照 " + charSet +"保存文件成功-");
}
}
19.PrintStream(打印流)
package javaio.printstream;
import java.io.IOException;
import java.io.PrintStream;
public class PrintStreamTest {
public static void main(String[] args)throws IOException{
PrintStream out = System.out;
//在默认情况下,PrintStream 输出数据的位置是 标准输出 ,即显示器
/* public void print(String s) {
if (s == null) {
s = "null";
}
write(s);
}*/
out.print("ikun");
//因为print底层使用的是write ,所以我们可以直接调用write进行打印/输出
out.write("小黑子".getBytes());
//我们可以去修改打印流输出的位置/设备
//1. 输出修改成"E:\文件下载\y.txt"
//2. “ikun,小黑子”就会输出到 E:\文件下载\y.txt
//3.
// public static void setOut(PrintStream out) {
// checkIO();
// setOut0(out); //native 方法, 修改out
// }
System.setOut(new PrintStream("E:\\文件下载\\y.txt"));
System.out.println("ikun,小黑子");
out.close();
}
}
20.PrintWriter(字符打印流)
package javaio.transformation;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class PrintWriterTest {
public static void main(String[] args) throws IOException {
//PrintWriter printWriter = new PrintWriter(System.out);
PrintWriter printWriter = new PrintWriter(new FileWriter("E:\\文件下载\\y.txt"));
printWriter.print("hi,小黑子");
printWriter.close();//flush + 关闭流,才会将数据写入到文件..
}
}
21.配置文件引出Properties
ip=192.168.100.100
user=root
pwd=123456
package javaio.propertiesTest;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Properties01 {
public static void main(String[] args) throws IOException {
//读取mysql.properties 文件,并且得到 ip ,user 和 pwd
BufferedReader br = new BufferedReader(new FileReader("ruoyi-admin/src/test/java/javaio/propertiesTest/mysql.properties"));
String line = "";
while ((line = br.readLine()) != null){ //循环读取
String[] sqlit = line.split("=");
System.out.println(sqlit[0] + "值是: " + sqlit[1]);
}
br.close();
}
}
22.Properties读取文件
package javaio.propertiesTest;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
public class Properties02 {
public static void main(String[] args) throws IOException {
//使用Properties 类来读取mysq.properties 文件
//1.创建Properties 对象
Properties properties = new Properties();
//2.加载指定配置文件
properties.load(new FileReader("ruoyi-admin/src/test/java/javaio/propertiesTest/mysql.properties"));
//3.把k - v显示控制台
properties.list(System.out);
//4. 根据key 获取对应的值
String user = properties.getProperty("user");
String pwd = properties.getProperty("pwd");
System.out.println("用户名=" + user);
System.out.println("密码是=" + pwd);
}
}
23.Properties修改文件
package javaio.propertiesTest;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Properties;
public class Properties03 {
public static void main(String[] args) throws IOException {
//使用Properties 类来创建 配置文件,修改配置文件内容
Properties properties = new Properties();
//创建
//1.如果该文件没有key,就是创建
//2.如果该文件有key,就是修改
/*
Properties 父类是 Hashtable , 底层Hashtable 核心方法
public synchronized V put(K key, V value) {
// Make sure the value is not null
if (value == null) {
throw new NullPointerException();
}
// Makes sure the key is not already in the hashtable.
Hashtable.Entry<?,?> tab[] = table;
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
@SuppressWarnings("unchecked")
Hashtable.Entry<K,V> entry = (Hashtable.Entry<K,V>)tab[index];
for(; entry != null ; entry = entry.next) {
if ((entry.hash == hash) && entry.key.equals(key)) {
V old = entry.value;
entry.value = value;
return old;
}
}
addEntry(hash, key, value, index);
return null;
}*/
properties.setProperty("charset","utf8");
properties.setProperty("user","达到发生");
properties.setProperty("pwd","abc111");
//将k-v 存储文件中即可
properties.store(new FileOutputStream("ruoyi-admin/src/test/java/javaio/propertiesTest/mysql2.properties"),"hello");
System.out.println("保存配置文件成功--");
}
}