| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.ini4j; |
| 17 | |
|
| 18 | |
import org.ini4j.spi.WinEscapeTool; |
| 19 | |
|
| 20 | |
import java.io.File; |
| 21 | |
import java.io.IOException; |
| 22 | |
import java.io.InputStream; |
| 23 | |
import java.io.Reader; |
| 24 | |
|
| 25 | |
import java.net.URL; |
| 26 | |
|
| 27 | |
public class Wini extends Ini |
| 28 | |
{ |
| 29 | |
private static final long serialVersionUID = -2781377824232440728L; |
| 30 | |
public static final char PATH_SEPARATOR = '\\'; |
| 31 | |
|
| 32 | |
public Wini() |
| 33 | 9 | { |
| 34 | 9 | Config cfg = Config.getGlobal().clone(); |
| 35 | |
|
| 36 | 9 | cfg.setEscape(false); |
| 37 | 9 | cfg.setEscapeNewline(false); |
| 38 | 9 | cfg.setGlobalSection(true); |
| 39 | 9 | cfg.setEmptyOption(true); |
| 40 | 9 | cfg.setMultiOption(false); |
| 41 | 9 | cfg.setPathSeparator(PATH_SEPARATOR); |
| 42 | 9 | setConfig(cfg); |
| 43 | 9 | } |
| 44 | |
|
| 45 | |
public Wini(File input) throws IOException, InvalidFileFormatException |
| 46 | |
{ |
| 47 | 3 | this(); |
| 48 | 3 | setFile(input); |
| 49 | 3 | load(); |
| 50 | 3 | } |
| 51 | |
|
| 52 | |
public Wini(URL input) throws IOException, InvalidFileFormatException |
| 53 | |
{ |
| 54 | 1 | this(); |
| 55 | 1 | load(input); |
| 56 | 1 | } |
| 57 | |
|
| 58 | |
public Wini(InputStream input) throws IOException, InvalidFileFormatException |
| 59 | |
{ |
| 60 | 1 | this(); |
| 61 | 1 | load(input); |
| 62 | 1 | } |
| 63 | |
|
| 64 | |
public Wini(Reader input) throws IOException, InvalidFileFormatException |
| 65 | |
{ |
| 66 | 1 | this(); |
| 67 | 1 | load(input); |
| 68 | 1 | } |
| 69 | |
|
| 70 | |
public String escape(String value) |
| 71 | |
{ |
| 72 | 5 | return WinEscapeTool.getInstance().escape(value); |
| 73 | |
} |
| 74 | |
|
| 75 | |
public String unescape(String value) |
| 76 | |
{ |
| 77 | 7 | return WinEscapeTool.getInstance().unescape(value); |
| 78 | |
} |
| 79 | |
} |