You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sl...@apache.org on 2011/02/26 17:35:32 UTC
[Lucene.Net] svn commit: r1074873 [3/3] - in /incubator/lucene.net/trunk/C#/src:
CHANGES.txt Lucene.Net/Store/IndexInput.cs Lucene.Net/Store/IndexOutput.cs
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/IndexInput.cs?rev=1074873&r1=1074872&r2=1074873&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs Sat Feb 26 16:35:31 2011
@@ -27,8 +27,6 @@ namespace Lucene.Net.Store
/// </seealso>
public abstract class IndexInput : System.ICloneable
{
- private byte[] bytes; // used by readString()
- private char[] chars; // used by readModifiedUTF8String()
private bool preUTF8Strings; // true if we are reading old (modified UTF8) string format
/// <summary>Reads and returns a single byte.</summary>
@@ -138,10 +136,7 @@ namespace Lucene.Net.Store
if (preUTF8Strings)
return ReadModifiedUTF8String();
int length = ReadVInt();
- if (bytes == null || length > bytes.Length)
- {
- bytes = new byte[(int) (length * 1.25)];
- }
+ byte[] bytes = new byte[length];
ReadBytes(bytes, 0, length);
return System.Text.Encoding.UTF8.GetString(bytes, 0, length);
}
@@ -149,8 +144,7 @@ namespace Lucene.Net.Store
private System.String ReadModifiedUTF8String()
{
int length = ReadVInt();
- if (chars == null || length > chars.Length)
- chars = new char[length];
+ char[] chars = new char[length];
ReadChars(chars, 0, length);
return new System.String(chars, 0, length);
}
@@ -262,9 +256,6 @@ namespace Lucene.Net.Store
{
}
- clone.bytes = null;
- clone.chars = null;
-
return clone;
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexOutput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/IndexOutput.cs?rev=1074873&r1=1074872&r2=1074873&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexOutput.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexOutput.cs Sat Feb 26 16:35:31 2011
@@ -32,8 +32,6 @@ namespace Lucene.Net.Store
public abstract class IndexOutput
{
- private UnicodeUtil.UTF8Result utf8Result = new UnicodeUtil.UTF8Result();
-
/// <summary>Writes a single byte.</summary>
/// <seealso cref="IndexInput.ReadByte()">
/// </seealso>
@@ -119,6 +117,7 @@ namespace Lucene.Net.Store
/// </seealso>
public virtual void WriteString(System.String s)
{
+ UnicodeUtil.UTF8Result utf8Result = new UnicodeUtil.UTF8Result();
UnicodeUtil.UTF16toUTF8(s, 0, s.Length, utf8Result);
WriteVInt(utf8Result.length);
WriteBytes(utf8Result.result, 0, utf8Result.length);