Example #1
0
        /// <summary>
        /// Creates a file, or opens an existing file. If necessary, parent directories will be created.
        /// </summary>
        /// <param name="fileSystem"> The filesystem abstraction to use </param>
        /// <param name="file"> The file to create or open </param>
        /// <returns> An output stream </returns>
        /// <exception cref="IOException"> If an error occurs creating directories or opening the file </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static java.io.OutputStream createOrOpenAsOutputStream(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File file, boolean append) throws java.io.IOException
        public static Stream CreateOrOpenAsOutputStream(FileSystemAbstraction fileSystem, File file, bool append)
        {
            if (file.ParentFile != null)
            {
                fileSystem.Mkdirs(file.ParentFile);
            }
            return(fileSystem.OpenAsOutputStream(file, append));
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.io.File fileContaining(org.neo4j.io.fs.FileSystemAbstraction fs, String content) throws java.io.IOException
        private File FileContaining(FileSystemAbstraction fs, string content)
        {
            File shortFile = _directory.file("file");

            fs.DeleteFile(shortFile);
            using (Stream outputStream = fs.OpenAsOutputStream(shortFile, false))
            {
                outputStream.Write(UTF8.encode(content), 0, UTF8.encode(content).Length);
                return(shortFile);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.io.OutputStream openAsOutputStream(java.io.File fileName, boolean append) throws java.io.IOException
        public override Stream OpenAsOutputStream(File fileName, bool append)
        {
            return(@delegate.OpenAsOutputStream(fileName, append));
        }