flipproperty.java

来自「simple spider 源码 better light faster ja」· Java 代码 · 共 28 行

JAVA
28
字号
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 + =
减小字号Ctrl + -
显示快捷键?