简体   繁体   中英

Java ini4j error reading file created by windows software

I am trying to use the ini4j to get data from a windows software log file. The file looks like:

[Production]
Code=I-MS01-11002
Time=2012-01-25T15:58:50+02:00
RequestType=Process Order
OrderID=0183

When I try:

Wini ini = new Wini(fileList[i]);
System.out.println(ini.keySet());

The output is: [?, P roduction]

Please advise where I am going wrong.

I have found the original file is saved in UTF16 format. A work around, that seems to work, but may not be the best way to do it:

InputStream is = new BufferedInputStream(new FileInputStream(fileList[i]));
Reader reader = new InputStreamReader(is, "UTF-16");
Ini ini = new Ini();
ini.load(reader);
System.out.println(ini.keySet());

The output is now: [Production]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM