//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void assertSecurityLogDoesNotContain(String message) throws java.io.IOException internal virtual void AssertSecurityLogDoesNotContain(string message) { FileSystemAbstraction fileSystem = _testDirectory.FileSystem; File workingDirectory = _testDirectory.directory(); File logFile = new File(workingDirectory, "logs/security.log"); Reader reader = fileSystem.OpenAsReader(logFile, UTF_8); StreamReader bufferedReader = new StreamReader(reader); string line; while (!string.ReferenceEquals((line = bufferedReader.ReadLine()), null)) { assertThat("Security log should not contain message '" + message + "'", !line.Contains(message)); } bufferedReader.Close(); reader.close(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static String fileContent(java.io.File file, org.neo4j.io.fs.FileSystemAbstraction fsa) throws java.io.IOException internal static string FileContent(File file, FileSystemAbstraction fsa) { int chunkSize = 128; StringBuilder stringBuilder = new StringBuilder(); using (Reader reader = fsa.OpenAsReader(file, Charsets.UTF_8)) { CharBuffer charBuffer = CharBuffer.wrap(new char[chunkSize]); while (reader.read(charBuffer) != -1) { charBuffer.flip(); stringBuilder.Append(charBuffer); charBuffer.clear(); } } return(stringBuilder.ToString()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static long[] readTxLogCounters(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File file, int numberOfCounters) throws java.io.IOException private static long[] ReadTxLogCounters(FileSystemAbstraction fs, File file, int numberOfCounters) { using (StreamReader reader = new StreamReader(fs.OpenAsReader(file, StandardCharsets.UTF_8))) { string line = reader.ReadLine(); string[] split = StringUtils.Split(line, TX_LOG_COUNTERS_SEPARATOR); if (split.Length != numberOfCounters) { throw new System.ArgumentException("Unexpected number of tx counters '" + numberOfCounters + "', file contains: '" + line + "'"); } long[] counters = new long[numberOfCounters]; for (int i = 0; i < split.Length; i++) { counters[i] = long.Parse(split[i]); } return(counters); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static java.util.List<String> readFromFile(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File file) throws java.io.IOException public static IList <string> ReadFromFile(FileSystemAbstraction fs, File file) { List <string> lines = new List <string>(); using (StreamReader r = new StreamReader(fs.OpenAsReader(file, UTF_8))) { while (true) { string line = r.ReadLine(); if (string.ReferenceEquals(line, null)) { break; } lines.Add(line); } } return(lines); }
private static void LoadPersistedSettings(Properties settings, File indexFolder, FileSystemAbstraction fs) { File settingsFile = new File(indexFolder, INDEX_CONFIG_FILE); if (fs.FileExists(settingsFile)) { try { using (Reader reader = fs.OpenAsReader(settingsFile, StandardCharsets.UTF_8)) { settings.load(reader); } } catch (IOException e) { throw new UncheckedIOException("Failed to read persisted fulltext index properties: " + settingsFile, e); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static java.util.List<String> readAllLines(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File logFilename) throws java.io.IOException internal static IList <string> ReadAllLines(FileSystemAbstraction fs, File logFilename) { IList <string> logLines = new List <string>(); // this is needed as the EphemeralFSA is broken, and creates a new file when reading a non-existent file from // a valid directory if (!fs.FileExists(logFilename)) { throw new FileNotFoundException("File does not exist."); } using (StreamReader reader = new StreamReader(fs.OpenAsReader(logFilename, StandardCharsets.UTF_8))) { for (string line; (line = reader.ReadLine()) != null;) { logLines.Add(line); } } return(logLines); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void load() throws java.io.IOException internal virtual void Load() { File securityLog = new File(_outerInstance.securityLog.AbsolutePath); using (FileSystemAbstraction fileSystem = outerInstance.Neo.fileSystem(), StreamReader bufferedReader = new StreamReader(fileSystem.OpenAsReader(securityLog, StandardCharsets.UTF_8))) { Lines = bufferedReader.lines().collect(java.util.stream.Collectors.toList()); } }