// end finally // end encodeFileToFile /// <summary>Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.</summary> /// <remarks>Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.</remarks> /// <param name="infile">Input file</param> /// <param name="outfile">Output file</param> /// <exception cref="System.IO.IOException">if there is an error</exception> /// <since>2.2</since> public static void DecodeFileToFile(string infile, string outfile) { byte[] decoded = Couchbase.Lite.Support.Base64.DecodeFromFile(infile); OutputStream @out = null; try { @out = new BufferedOutputStream(new FileOutputStream(outfile)); @out.Write(decoded); } catch (IOException e) { // end try throw; } finally { // Catch and release to execute finally{} // end catch try { @out.Close(); } catch (Exception) { } } }
// end encodeFromFile /// <summary>Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.</summary> /// <remarks>Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.</remarks> /// <param name="infile">Input file</param> /// <param name="outfile">Output file</param> /// <exception cref="System.IO.IOException">if there is an error</exception> /// <since>2.2</since> public static void EncodeFileToFile(string infile, string outfile) { string encoded = Couchbase.Lite.Support.Base64.EncodeFromFile(infile); OutputStream @out = null; try { @out = new BufferedOutputStream(new FileOutputStream(outfile)); @out.Write(Sharpen.Runtime.GetBytesForString(encoded, "US-ASCII")); } catch (IOException e) { // Strict, 7-bit output. // end try throw; } finally { // Catch and release to execute finally{} // end catch try { @out.Close(); } catch (Exception) { } } }