Java Code Examples for com.intellij.openapi.util.io.FileUtil#loadLines()
The following examples show how to use
com.intellij.openapi.util.io.FileUtil#loadLines() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Neo4jServerLoader.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
private static synchronized void cleanupNeo4jKnownHosts(Neo4jServerLoader neo4jServerLoader) { File hostsFile = Config.defaultConfig().trustStrategy().certFile(); try { if (hostsFile != null && hostsFile.isFile()) { List<String> lines = FileUtil.loadLines(hostsFile); List<String> updatedLines = lines.stream() .filter((line) -> !line.startsWith(neo4jServerLoader.getBoltHost() + ":" + neo4jServerLoader.getBoltPort())) .filter((line) -> !line.isEmpty()) .collect(Collectors.toList()); FileUtil.writeToFile(hostsFile, String.join(System.lineSeparator(), updatedLines) + System.lineSeparator()); } } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } }
Example 2
Source File: SystemInfo.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override protected Map<String, String> compute() { if (isUnix && !isMac) { try { List<String> lines = FileUtil.loadLines("/etc/os-release"); Map<String, String> info = ContainerUtil.newHashMap(); for (String line : lines) { int p = line.indexOf('='); if (p > 0) { String name = line.substring(0, p); String value = StringUtil.unquoteString(line.substring(p + 1)); if (!StringUtil.isEmptyOrSpaces(name) && !StringUtil.isEmptyOrSpaces(value)) { info.put(name, value); } } } return info; } catch (IOException ignored) { } } return Collections.emptyMap(); }
Example 3
Source File: PantsOutputMessageTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public List<PantsOutputMessage> parseCompilationOutputFile(String pathToFile) throws FileNotFoundException, IOException { assertNotNull(pathToFile); final List<String> lines = FileUtil.loadLines(new File(pathToFile)); assertNotNull(lines); List<PantsOutputMessage> list = new ArrayList<>(); for (String line : lines) { list.add(PantsOutputMessage.parseOutputMessage(line)); } return list; }
Example 4
Source File: Unity3dProjectImportUtil.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Nullable public static String loadVersionFromProject(@Nonnull String path) { File file = new File(path, "ProjectSettings/ProjectVersion.txt"); if(!file.exists()) { return null; } try { List<String> lines = FileUtil.loadLines(file); String prefix = "m_EditorVersion:"; for(String line : lines) { if(line.startsWith(prefix)) { String version = line.substring(prefix.length(), line.length()); return Unity3dBundleType.filterReleaseInfo(version.trim()); } } } catch(IOException ignored) { } return null; }