You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/02/03 16:38:59 UTC

[lucenenet] 04/08: Lucene.Net.Support.DictionaryExtensions: Factored out Load() and Store() methods in favor of J2N's implementation

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 2dd3d256833cc698a0abe4561b05ca68971fcf21
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Feb 3 21:31:38 2020 +0700

    Lucene.Net.Support.DictionaryExtensions: Factored out Load() and Store() methods in favor of J2N's implementation
---
 src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs |  5 +-
 src/Lucene.Net/Support/DictionaryExtensions.cs  | 62 -------------------------
 2 files changed, 3 insertions(+), 64 deletions(-)

diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
index 972d6f6..297e601 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
@@ -1,4 +1,5 @@
-using J2N.Text;
+using J2N;
+using J2N.Text;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
@@ -85,7 +86,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             this.props = new Dictionary<string, string>();
             writer.Flush();
             ms.Position = 0;
-            props.Load(ms); 
+            props.LoadProperties(ms); 
 
             // make sure work dir is set properly 
             string temp;
diff --git a/src/Lucene.Net/Support/DictionaryExtensions.cs b/src/Lucene.Net/Support/DictionaryExtensions.cs
index e3e60ac..09c9bd5 100644
--- a/src/Lucene.Net/Support/DictionaryExtensions.cs
+++ b/src/Lucene.Net/Support/DictionaryExtensions.cs
@@ -61,67 +61,5 @@ namespace Lucene.Net.Support
         {
             return new ConcurrentDictionaryWrapper<TKey, TValue>(dictionary);
         }
-
-        /// <summary>
-        /// Loads properties from the specified <see cref="Stream"/>. The encoding is
-        /// ISO8859-1. 
-        /// </summary>
-        /// <remarks>
-        /// The Properties file is interpreted according to the
-        /// following rules:
-        /// <list type="bullet">
-        ///     <item><description>
-        ///         Empty lines are ignored.
-        ///     </description></item>
-        ///     <item><description>
-        ///         Lines starting with either a "#" or a "!" are comment lines and are
-        ///         ignored.
-        ///     </description></item>
-        ///     <item><description>
-        ///         A backslash at the end of the line escapes the following newline
-        ///         character ("\r", "\n", "\r\n"). If there's a whitespace after the
-        ///         backslash it will just escape that whitespace instead of concatenating
-        ///         the lines. This does not apply to comment lines.
-        ///     </description></item>
-        ///     <item><description>
-        ///         A property line consists of the key, the space between the key and
-        ///         the value, and the value. The key goes up to the first whitespace, "=" or
-        ///         ":" that is not escaped. The space between the key and the value contains
-        ///         either one whitespace, one "=" or one ":" and any number of additional
-        ///         whitespaces before and after that character. The value starts with the
-        ///         first character after the space between the key and the value.
-        ///     </description></item>
-        ///     <item><description>
-        ///         Following escape sequences are recognized: "\ ", "\\", "\r", "\n",
-        ///         "\!", "\#", "\t", "\b", "\f", and "&#92;uXXXX" (unicode character).
-        ///     </description></item>
-        /// </list>
-        /// <para/>
-        /// This method is to mimic and interoperate with the Properties class in Java, which
-        /// is essentially a string dictionary that natively supports importing and exporting to this format.
-        /// </remarks>
-        /// <param name="dict">This dictionary.</param>
-        /// <param name="input">The <see cref="Stream"/>.</param>
-        /// <exception cref="IOException">If error occurs during reading from the <see cref="Stream"/>.</exception>
-        public static void Load(this IDictionary<string, string> dict, Stream input)
-        {
-            J2N.PropertyExtensions.LoadProperties(dict, input);
-        }
-
-        /// <summary>
-        /// Stores the mappings in this Properties to the specified
-        /// <see cref="Stream"/>, putting the specified comment at the beginning. The
-        /// output from this method is suitable for being read by the
-        /// <see cref="Load(IDictionary{string, string}, Stream)"/> method.
-        /// </summary>
-        /// <param name="dict">This dictionary.</param>
-        /// <param name="output">The output <see cref="Stream"/> to write to.</param>
-        /// <param name="comments">The comments to put at the beginning.</param>
-        /// <exception cref="IOException">If an error occurs during the write to the <see cref="Stream"/>.</exception>
-        /// <exception cref="InvalidCastException">If the key or value of a mapping is not a <see cref="string"/>.</exception>
-        public static void Store(this IDictionary<string, string> dict, Stream output, string comments)
-        {
-            J2N.PropertyExtensions.SaveProperties(dict, output, comments);
-        }
     }
 }
\ No newline at end of file