当前位置: 首页>>代码示例>>Java>>正文


Java InvalidFileFormatException类代码示例

本文整理汇总了Java中org.ini4j.InvalidFileFormatException的典型用法代码示例。如果您正苦于以下问题:Java InvalidFileFormatException类的具体用法?Java InvalidFileFormatException怎么用?Java InvalidFileFormatException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidFileFormatException类属于org.ini4j包,在下文中一共展示了InvalidFileFormatException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertBad

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
@SuppressWarnings("empty-statement")
private void assertBad(String[] values) throws Exception
{
    IniParser parser = new IniParser();
    IniHandler handler = EasyMock.createNiceMock(IniHandler.class);

    for (String s : values)
    {
        try
        {
            parser.parse(new ByteArrayInputStream(s.getBytes()), handler);
            fail("expected InvalidIniFormatException: " + s);
        }
        catch (InvalidFileFormatException x)
        {
        }
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:19,代码来源:IniParserTest.java

示例2: parseSectionLine

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
private String parseSectionLine(String line, IniSource source, IniHandler handler) throws InvalidFileFormatException
{
    String sectionName;

    if (line.charAt(line.length() - 1) != SECTION_END)
    {
        parseError(line, source.getLineNumber());
    }

    sectionName = unescapeFilter(line.substring(1, line.length() - 1).trim());
    if ((sectionName.length() == 0) && !getConfig().isUnnamedSection())
    {
        parseError(line, source.getLineNumber());
    }

    if (getConfig().isLowerCaseSection())
    {
        sectionName = sectionName.toLowerCase(Locale.getDefault());
    }

    handler.startSection(sectionName);

    return sectionName;
}
 
开发者ID:qxo,项目名称:ini4j,代码行数:25,代码来源:IniParser.java

示例3: assertBad

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
@SuppressWarnings("empty-statement")
private void assertBad(String[] values) throws Exception
{
    IniParser parser = new IniParser();
    IniHandler handler = EasyMock.createNiceMock(IniHandler.class);

    for (String s : values)
    {
        try
        {
            parser.parse(new ByteArrayInputStream(s.getBytes()), handler);
            fail("expected InvalidIniFormatException: " + s);
        }
        catch (InvalidFileFormatException x)
        {
            ;
        }
    }
}
 
开发者ID:qxo,项目名称:ini4j,代码行数:20,代码来源:IniParserTest.java

示例4: parseOptionLine

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
void parseOptionLine(String line, HandlerBase handler, int lineNumber) throws InvalidFileFormatException
{
    int idx = indexOfOperator(line);
    String name = null;
    String value = null;

    if (idx < 0)
    {
        if (getConfig().isEmptyOption())
        {
            name = line;
        }
        else
        {
            parseError(line, lineNumber);
        }
    }
    else
    {
        name = unescapeKey(line.substring(0, idx)).trim();
        value = unescapeValue(line.substring(idx + 1)).trim();
    }

    if (name.length() == 0)
    {
        parseError(line, lineNumber);
    }

    if (getConfig().isLowerCaseOption())
    {
        name = name.toLowerCase(Locale.getDefault());
    }

    handler.handleOption(name, value);
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:36,代码来源:AbstractParser.java

示例5: parseSectionLine

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
private String parseSectionLine(String line, IniSource source, IniHandler handler) throws InvalidFileFormatException
{
    String sectionName;

  if (line.charAt(line.length() - 1) != SECTION_END)
    {
      int sectionEnd = line.lastIndexOf(SECTION_END);
      String afterSectionEnd = line.substring(sectionEnd + 1).trim();
      if (afterSectionEnd.isEmpty() || isComment(afterSectionEnd.charAt(0)))
      {
        line = line.substring(0, sectionEnd + 1);
      }
      else
      {
        parseError(line, source.getLineNumber());
      }
    }

    sectionName = unescapeKey(line.substring(1, line.length() - 1).trim());
    if ((sectionName.length() == 0) && !getConfig().isUnnamedSection())
    {
        parseError(line, source.getLineNumber());
    }

    if (getConfig().isLowerCaseSection())
    {
        sectionName = sectionName.toLowerCase(Locale.getDefault());
    }

    handler.startSection(sectionName);

    return sectionName;
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:34,代码来源:IniParser.java

示例6: testBad

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
@Test public void testBad() throws Exception
{
    OptionsParser parser = new OptionsParser();
    OptionsHandler handler = EasyMock.createNiceMock(OptionsHandler.class);

    try
    {
        parser.parse(new ByteArrayInputStream(NONAME.getBytes()), handler);
        missing(InvalidFileFormatException.class);
    }
    catch (InvalidFileFormatException x)
    {
        //
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:16,代码来源:OptionsParserTest.java

示例7: testUTF8_fail

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
@Test public void testUTF8_fail() throws Exception
{
    try
    {
        test("UTF-8.ini", "UTF-16");
        missing(InvalidFileFormatException.class);
    }
    catch (InvalidFileFormatException x)
    {
        //
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:13,代码来源:UnicodeInputStreamReaderTest.java

示例8: checkProvenance

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
private void checkProvenance(
        String moduleName,
        String methodName,
        String release,
        String ver,
        List<UObject> methparams,
        List<SubActionSpec> subs,
        List<String> wsobjs,
        List<ProvenanceAction> prov)
        throws Exception, IOException, InvalidFileFormatException,
        JsonClientException {
    if (release != null) {
        ver = ver + "-" + release;
    }

    assertThat("number of provenance actions",
            prov.size(), is(1));
    ProvenanceAction pa = prov.get(0);
    long got = DATE_PARSER.parseDateTime(pa.getTime()).getMillis();
    long now = new Date().getTime();
    assertTrue("got prov time < now ", got < now);
    assertTrue("got prov time > now - 5m", got > now - (5 * 60 * 1000));
    assertThat("correct service", pa.getService(), is(moduleName));
    assertThat("correct service version", pa.getServiceVer(),
            is(ver));
    assertThat("correct method", pa.getMethod(), is(methodName));
    assertThat("number of params", pa.getMethodParams().size(),
            is(methparams.size()));
    for (int i = 1; i < methparams.size(); i++) {
        assertThat("params not equal",
                pa.getMethodParams().get(i).asClassInstance(Object.class),
                is(methparams.get(i).asClassInstance(Object.class)));
    }
    assertThat("correct incoming ws objs",
            new HashSet<String>(pa.getInputWsObjects()),
            is(new HashSet<String>(wsobjs)));
    checkSubActions(pa.getSubactions(), subs);
}
 
开发者ID:kbase,项目名称:kb_sdk,代码行数:39,代码来源:CallbackServerTest.java

示例9: create

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
public static Configuration create(String profile) throws InvalidFileFormatException, IOException {
    if (profile == null) {
        profile = "direct";
    }
    Ini ini = new Ini();
    ini.load(new File(System.getProperty("user.home") + "/.scafa/" + profile + ".ini"));
    return new Configuration(ini);
}
 
开发者ID:apetrelli,项目名称:scafa,代码行数:9,代码来源:Configuration.java

示例10: testSecondaryLoadOverridesOriginalDefs

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
@Test
public void testSecondaryLoadOverridesOriginalDefs()
    throws InvalidFileFormatException, IOException {
  Ini ini = new Ini();
  Reader originalInput = new StringReader(Joiner.on("\n").join(
      "[alias]",
      "  buck = //src/com/facebook/buck/cli:cli",
      "[cache]",
      "  mode = dir"));
  Reader overrideInput = new StringReader(Joiner.on("\n").join(
      "[alias]",
      "  test_util = //test/com/facebook/buck/util:util",
      "[cache]",
      "  mode ="));
  ini.load(originalInput);
  ini.load(overrideInput);

  Section aliasSection = ini.get("alias");
  assertEquals(
      "Should be the union of the two [alias] sections.",
      ImmutableMap.of(
          "buck", "//src/com/facebook/buck/cli:cli",
          "test_util", "//test/com/facebook/buck/util:util"),
      aliasSection);

  Section cacheSection = ini.get("cache");
  assertEquals(
      "Values from overrideInput should supercede those from originalInput, as appropriate.",
      ImmutableMap.of("mode", ""),
      cacheSection);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:32,代码来源:IniTest.java

示例11: init

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
public static String[] init() throws InvalidFileFormatException, IOException{
	combinations = new LinkedList<String[]>();
			
	Ini ini = new Ini(new File(fileName));
	int count = Integer.parseInt( ini.get("General", "count") );
	
	for(int i = 1 ; i <= count ; i++){
		String a1 = ini.get("Agents-" + i, "agentCount");
		String t1 = ini.get("Agents-" + i, "taskCount");
		combinations.add(new String[]{a1,t1});
	}
	
	return getSingleRandomCombination();
}
 
开发者ID:wikiteams,项目名称:aon-emerging-wikiteams,代码行数:15,代码来源:DescribeUniverseBulkLoad.java

示例12: parseOptionLine

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
void parseOptionLine(String line, HandlerBase handler, int lineNumber) throws InvalidFileFormatException
{
    int idx = indexOfOperator(line);
    String name = null;
    String value = null;

    if (idx < 0)
    {
        if (getConfig().isEmptyOption())
        {
            name = line;
        }
        else
        {
            parseError(line, lineNumber);
        }
    }
    else
    {
        name = unescapeFilter(line.substring(0, idx)).trim();
        value = unescapeFilter(line.substring(idx + 1)).trim();
    }

    if (name.length() == 0)
    {
        parseError(line, lineNumber);
    }

    if (getConfig().isLowerCaseOption())
    {
        name = name.toLowerCase(Locale.getDefault());
    }

    handler.handleOption(name, value);
}
 
开发者ID:qxo,项目名称:ini4j,代码行数:36,代码来源:AbstractParser.java

示例13: parse

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
private void parse(IniSource source, OptionsHandler handler) throws IOException, InvalidFileFormatException
{
    handler.startOptions();
    for (String line = source.readLine(); line != null; line = source.readLine())
    {
        parseOptionLine(line, handler, source.getLineNumber());
    }

    handler.endOptions();
}
 
开发者ID:qxo,项目名称:ini4j,代码行数:11,代码来源:OptionsParser.java

示例14: parseError

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
protected void parseError(String line, int lineNumber) throws InvalidFileFormatException
{
    throw new InvalidFileFormatException("parse error (at line: " + lineNumber + "): " + line);
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:5,代码来源:AbstractParser.java

示例15: parse

import org.ini4j.InvalidFileFormatException; //导入依赖的package包/类
public void parse(InputStream input, IniHandler handler) throws IOException, InvalidFileFormatException
{
    parse(newIniSource(input, handler), handler);
}
 
开发者ID:qxo,项目名称:ini4j,代码行数:5,代码来源:IniParser.java


注:本文中的org.ini4j.InvalidFileFormatException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。