⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flipproperty.java

📁 simple spider 源码 better light faster java 书籍源码.
💻 JAVA
字号:
package com.develop.ss.ant;

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

public class FlipProperty {
  public static void main(String[] args) throws IOException {
    flip(args[0], args[1]);
  }

  private static void flip(String propFile, String propName) throws IOException {
    Properties props = new Properties();
    FileInputStream inStream = new FileInputStream(propFile);
    props.load(inStream);
    inStream.close();
    String value = props.getProperty(propName);
    int newValue = 1 - Integer.parseInt(value);
    props.setProperty(propName, Integer.toString(newValue));
    FileOutputStream out = new FileOutputStream(propFile);
    props.store(out, "Auto saved by " + FlipProperty.class);
    out.close();
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -