This and that for editing ini in Java. : inieditor-java

When I edited the ini last time (https://qiita.com/haniokasai/items/336afb29060601e74a41), the resulting ini file was messed up, so look for an alternative.

Caution

The library for this article may not work, so see my separate article. -> It becomes strange if there is an item with the same variable name.

intellij-deps-ini4j https://github.com/JetBrains/intellij-deps-ini4j inieditor-java https://github.com/nikhaldi/inieditor-java FastIni https://github.com/onlynight/FastIni java-configparser https://github.com/ASzc/java-configparser

It doesn't matter which one, but it seems to be easy to use IniEditor (https://github.com/nikhaldi/inieditor-java), I decided on you.

Maven

<!-- https://mvnrepository.com/artifact/org.ini4j/ini4j -->
<dependency>
  <groupId>com.nikhaldimann</groupId>
  <artifactId>inieditor</artifactId>
  <version>r6</version>
</dependency>

read ini

IniEditor ini = new IniEditor();
ini.load("sample.ini");
ini.get("section","option");//example
//[section]
//option=example
ini.save("sample.ini");

write ini

IniEditor ini = new IniEditor();
ini.load("sample.ini");
ini.set("section","option");
ini.save("sample.ini");

Erase the ini section

IniEditor ini = new IniEditor();
ini.load("sample.ini");        
ini.remove("section_name");
ini.save("sample.ini");

Other

You can also add blank lines and comments.

Recommended Posts

This and that for editing ini in Java. : inieditor-java
This and that about Base64 (Java)
[Java] for Each and sorted in Lambda
This and that of the implementation of date judgment within the period in Java
[Java] Explains ConcurrentModificationException that occurs in java.util.ArrayList for newcomers
Docker settings and this and that
Edit ini in Java: ini4j
Java history in this world
[Rails] strftime this and that
Digital certificate this and that
Java while and for statements
Base64 encoder this and that
[For beginners] Explanation of classes, instances, and statics in Java
Problems that can easily be mistaken for Java and JavaScript
StringUtils.isNotBlank is convenient for empty judgment and null judgment in java
Tips for using Salesforce SOAP and Bulk API in Java
Tools and commands that may be useful for Java troubleshooting
Java version notation that changes in Java 10
AWS SDK for Java 1.11.x and 2.x
Rock-paper-scissors game for beginners in Java
Java for beginners, expressions and operators 1
Encoding and Decoding example in Java
[For beginners] Run Selenium in Java
Java for beginners, expressions and operators 2
This and that of the JDK
Understanding equals and hashCode in Java
This and that of Core Graphics
Settings for SSL debugging in Java
Classes and instances Java for beginners
Hello world in Java and Gradle
This and that of exclusive control
How to test a private method in Java and partially mock that method
Review of "strange Java" and Java knowledge that is often forgotten in Java Bronze
This and that of Swift corner Radius
First steps for deep learning in Java
[For beginners] Difference between Java and Kotlin
[About JDBC that connects Java and SQL]
[Java] Proxy for logging SQL and SQL results
Arrylist and linked list difference in java
Program PDF headers and footers in Java
Learn Flyweight patterns and ConcurrentHashMap in Java
Java Direction in C ++ Design and Evolution
Java to C and C to Java in Android Studio
Reading and writing gzip files in Java
Difference between int and Integer in Java
Discrimination of Enums in Java 7 and above
[Java] Difference between equals and == in a character string that is a reference type
Technology excerpt that can be used for creating EC sites in Java training
[Deep Learning from scratch] in Java 1. For the time being, differentiation and partial differentiation
Java that outputs vmg format file in eml format
Regarding the transient modifier and serialization in Java
Create barcodes and QR codes in Java PDF
Detect similar videos in Java and OpenCV rev.2
Review notes for Java 1.7 and later file copies
Technology for reading Java source code in Eclipse
Parallel and parallel processing in various languages (Java edition)
I studied for 3 weeks and passed Java Bronze
Difference between next () and nextLine () in Java Scanner
Solution for NetBeans 8.2 not working in Java 9 environment
Differences in writing Java, C # and Javascript classes
Capture and save from selenium installation in Java