Coverage Report - org.ini4j.Wini
 
Classes in this File Line Coverage Branch Coverage Complexity
Wini
100%
25/25
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005,2009 Ivan SZKIBA
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
 }