You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by bu...@apache.org on 2007/05/24 21:42:48 UTC
svn commit: r541402 - in /lucene/java/trunk: CHANGES.txt
src/java/org/apache/lucene/store/BufferedIndexInput.java
Author: buschmi
Date: Thu May 24 12:42:47 2007
New Revision: 541402
URL: http://svn.apache.org/viewvc?view=rev&rev=541402
Log:
LUCENE-430: Delay allocation of the buffer after a clone of BufferedIndexInput.
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/src/java/org/apache/lucene/store/BufferedIndexInput.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=541402&r1=541401&r2=541402
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu May 24 12:42:47 2007
@@ -180,6 +180,10 @@
4. LUCENE-882: Spellchecker doesn't store the ngrams anymore but only indexes
them to keep the spell index small. (Daniel Naber)
+
+ 5. LUCENE-430: Delay allocation of the buffer after a clone of BufferedIndexInput.
+ Together with LUCENE-888 this will allow to adjust the buffer size
+ dynamically. (Paul Elschot, Michael Busch)
Documentation
Modified: lucene/java/trunk/src/java/org/apache/lucene/store/BufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/BufferedIndexInput.java?view=diff&rev=541402&r1=541401&r2=541402
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/BufferedIndexInput.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/BufferedIndexInput.java Thu May 24 12:42:47 2007
@@ -88,8 +88,10 @@
if (bufferLength <= 0)
throw new IOException("read past EOF");
- if (buffer == null)
+ if (buffer == null) {
buffer = new byte[BUFFER_SIZE]; // allocate buffer lazily
+ seekInternal(bufferStart);
+ }
readInternal(buffer, 0, bufferLength);
bufferStart = start;
@@ -127,10 +129,10 @@
public Object clone() {
BufferedIndexInput clone = (BufferedIndexInput)super.clone();
- if (buffer != null) {
- clone.buffer = new byte[BUFFER_SIZE];
- System.arraycopy(buffer, 0, clone.buffer, 0, bufferLength);
- }
+ clone.buffer = null;
+ clone.bufferLength = 0;
+ clone.bufferPosition = 0;
+ clone.bufferStart = getFilePointer();
return clone;
}