From 54773d36a368b7c1ed03cd6500ae023093331ad5 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 31 Jan 2013 04:39:38 +0000 Subject: [PATCH] clear nocommits git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1440845 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/util/BytesRefHash.java | 2 +- .../apache/lucene/util/packed/PackedInts.java | 41 +++++++++++++++++-- .../apache/lucene/util/TestBytesRefHash.java | 3 +- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java index 88b24396ed6..8e50bc6ec75 100644 --- a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java +++ b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java @@ -130,7 +130,7 @@ public final class BytesRefHash { * order to reuse this {@link BytesRefHash} instance. *

*/ - private int[] compact() { + int[] compact() { assert bytesStart != null : "Bytesstart is null - not initialized"; int upto = 0; for (int i = 0; i < hashSize; i++) { diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java index 6d7edf8a02e..64541a7f921 100644 --- a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java +++ b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java @@ -848,7 +848,18 @@ public class PackedInts { } } - //nocommit javadoc + /** + * Expert: Restore a {@link Reader} from a stream without reading metadata at + * the beginning of the stream. This method is useful to restore data when + * metadata has been previously read using {@link #readHeader(DataInput)}. + * + * @param in the stream to read data from, positioned at the beginning of the packed values + * @param header metadata result from readHeader() + * @return a Reader + * @throws IOException If there is a low-level I/O error + * @see #readHeader(DataInput) + * @lucene.internal + */ public static Reader getReaderNoHeader(DataInput in, Header header) throws IOException { return getReaderNoHeader(in, header.format, header.version, header.valueCount, header.bitsPerValue); } @@ -965,7 +976,19 @@ public class PackedInts { } } - //nocommit javadoc + /** + * Expert: Construct a direct {@link Reader} from an {@link IndexInput} + * without reading metadata at the beginning of the stream. This method is + * useful to restore data when metadata has been previously read using + * {@link #readHeader(DataInput)}. + * + * @param in the stream to read data from, positioned at the beginning of the packed values + * @param header metadata result from readHeader() + * @return a Reader + * @throws IOException If there is a low-level I/O error + * @see #readHeader(DataInput) + * @lucene.internal + */ public static Reader getDirectReaderNoHeader(IndexInput in, Header header) throws IOException { return getDirectReaderNoHeader(in, header.format, header.version, header.valueCount, header.bitsPerValue); } @@ -1200,8 +1223,18 @@ public class PackedInts { } } - //nocommit javadoc - public static Header readHeader(IndexInput in) throws IOException { + /** + * Expert: reads only the metadata from a stream. This is useful to later + * restore a stream or open a direct reader via + * {@link #getReaderNoHeader(DataInput, Header)} + * or {@link #getDirectReaderNoHeader(IndexInput, Header)}. + * @param in the stream to read data + * @return packed integer metadata. + * @throws IOException If there is a low-level I/O error + * @see #getReaderNoHeader(DataInput, Header) + * @see #getDirectReaderNoHeader(IndexInput, Header) + */ + public static Header readHeader(DataInput in) throws IOException { final int version = CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_CURRENT); final int bitsPerValue = in.readVInt(); assert bitsPerValue > 0 && bitsPerValue <= 64: "bitsPerValue=" + bitsPerValue; diff --git a/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java b/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java index f3f61596bc9..3be9e6f151d 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java @@ -133,7 +133,6 @@ public class TestBytesRefHash extends LuceneTestCase { /** * Test method for {@link org.apache.lucene.util.BytesRefHash#compact()}. */ - /* nocommit: rewrite in terms of TestSort? @Test public void testCompact() { BytesRef ref = new BytesRef(); @@ -170,7 +169,7 @@ public class TestBytesRefHash extends LuceneTestCase { assertEquals(0, hash.size()); hash.reinit(); } - }*/ + } /** * Test method for