nuke i/o from byteblockpool

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1438216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-01-24 21:55:54 +00:00
parent 2857df98de
commit bfeaaf83a1
2 changed files with 3 additions and 29 deletions

View File

@ -16,12 +16,10 @@ package org.apache.lucene.util;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.apache.lucene.store.DataOutput;
import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF;
/**
@ -297,18 +295,6 @@ public final class ByteBlockPool {
assert term.length >= 0;
return term;
}
/**
* Dereferences the byte block according to {@link BytesRef} offset. The offset
* is interpreted as the absolute offset into the {@link ByteBlockPool}.
*/
public final BytesRef deref(BytesRef bytes) {
final int offset = bytes.offset;
byte[] buffer = buffers[offset >> BYTE_BLOCK_SHIFT];
int pos = offset & BYTE_BLOCK_MASK;
bytes.bytes = buffer;
bytes.offset = pos;
return bytes;
}
/**
* Copies the given {@link BytesRef} at the current positions (
@ -365,18 +351,5 @@ public final class ByteBlockPool {
} while (true);
return bytes;
}
/**
* Writes the pools content to the given {@link DataOutput}
*/
public final void writePool(final DataOutput out) throws IOException {
int bytesOffset = byteOffset;
int block = 0;
while (bytesOffset > 0) {
out.writeBytes(buffers[block++], BYTE_BLOCK_SIZE);
bytesOffset -= BYTE_BLOCK_SIZE;
}
out.writeBytes(buffers[block], byteUpto);
}
}

View File

@ -27,6 +27,7 @@ import org.apache.lucene.store.RAMDirectory;
*/
public class TestByteBlockPool extends LuceneTestCase {
/* nocommit: test this in some other way than dumping out
public void testCopyRefAndWrite() throws IOException {
Counter bytesUsed = Counter.newCounter();
ByteBlockPool pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed));
@ -76,5 +77,5 @@ public class TestByteBlockPool extends LuceneTestCase {
}
dir.close();
}
}
} */
}