List of usage examples for org.eclipse.jgit.attributes AttributesNode parse
public void parse(InputStream in) throws IOException
From source file:com.diffplug.gradle.spotless.GitAttributesLineEndingPolicy.java
License:Apache License
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(File file) { if (file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace();// ww w.j a va 2s. c o m } } return Collections.emptyList(); }
From source file:com.diffplug.spotless.extra.GitAttributesLineEndings.java
License:Apache License
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(@Nullable File file) { if (file != null && file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace();/*from w w w . j av a2 s . c o m*/ } } return Collections.emptyList(); }