You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2011/05/09 12:36:45 UTC

[Lucene.Net] svn commit: r1100946 - /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs

Author: digy
Date: Mon May  9 10:36:45 2011
New Revision: 1100946

URL: http://svn.apache.org/viewvc?rev=1100946&view=rev
Log:
[LUCENENET-412]

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs?rev=1100946&r1=1100945&r2=1100946&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs Mon May  9 10:36:45 2011
@@ -58,6 +58,10 @@ namespace Lucene.Net.Index
 		private IndexOutput indexStream;
 		
 		private bool doClose;
+
+        //DIGY
+        //To avoid to call "System.Text.Encoding.GetEncoding("UTF-8")" repeatedly
+        private System.Text.Encoding defaultEncoding = System.Text.Encoding.GetEncoding("UTF-8"); 
 		
 		internal FieldsWriter(Directory d, System.String segment, FieldInfos fn)
 		{
@@ -270,7 +274,7 @@ namespace Lucene.Net.Index
 					}
 					else
 					{
-						byte[] x = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(field.StringValue());
+						byte[] x = defaultEncoding.GetBytes(field.StringValue());
 						data = CompressionTools.Compress(x, 0, x.Length);
 					}
 					len = data.Length;