package com.lemon.json;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @program: Lemon
 * @description:
 * @author: ray
 * @create: 2022-09-22 09:15
 **/
public class PropertiesDemo {
    /*
     *
     *
     * */
    public static void main(String[] args) throws IOException {
        // ProPerties 是一个弱化版的HashMap，一般只存在String类型key和value

        Properties prop = new Properties();
        prop.setProperty("name", "lisi");
        prop.setProperty("age", "19");
        System.out.println(prop);

        FileInputStream file = new FileInputStream("src/test/resources/config.properties");
        //读取文件内容
        prop.load(file);

        FileOutputStream filo = new FileOutputStream("src/test/resources/config.properties");
        // 读取文件并重写
        prop.store(filo, "beizhu");
        System.out.println(prop);

        // File操作文件或者文件夹、创建、删除、移动
        // IO流

        try {
            method();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public static void method() throws IOException{

    }
}
