Index: lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java (revision 1050777) +++ lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java (working copy) @@ -535,9 +535,8 @@ if (posPendingCount > freq) { position = 0; while(posPendingCount != freq) { - if ((proxIn.readByte() & 0x80) == 0) { - posPendingCount--; - } + proxIn.readVInt(); + posPendingCount--; } } Index: lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java =================================================================== --- lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java (revision 1050777) +++ lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java (working copy) @@ -144,6 +144,68 @@ } } + @Override + public short readShort() throws IOException { + if (2 <= (bufferLength-bufferPosition)) { + return (short) (((buffer[bufferPosition++] & 0xFF) << 8) | (buffer[bufferPosition++] & 0xFF)); + } else { + return super.readShort(); + } + } + + @Override + public int readInt() throws IOException { + if (4 <= (bufferLength-bufferPosition)) { + return ((buffer[bufferPosition++] & 0xFF) << 24) | ((buffer[bufferPosition++] & 0xFF) << 16) + | ((buffer[bufferPosition++] & 0xFF) << 8) | (buffer[bufferPosition++] & 0xFF); + } else { + return super.readInt(); + } + } + + @Override + public long readLong() throws IOException { + if (8 <= (bufferLength-bufferPosition)) { + final int i1 = ((buffer[bufferPosition++] & 0xff) << 24) | ((buffer[bufferPosition++] & 0xff) << 16) | + ((buffer[bufferPosition++] & 0xff) << 8) | (buffer[bufferPosition++] & 0xff); + final int i2 = ((buffer[bufferPosition++] & 0xff) << 24) | ((buffer[bufferPosition++] & 0xff) << 16) | + ((buffer[bufferPosition++] & 0xff) << 8) | (buffer[bufferPosition++] & 0xff); + return (((long)i1) << 32) | (i2 & 0xFFFFFFFFL); + } else { + return super.readLong(); + } + } + + @Override + public int readVInt() throws IOException { + if (5 <= (bufferLength-bufferPosition)) { + byte b = buffer[bufferPosition++]; + int i = b & 0x7F; + for (int shift = 7; (b & 0x80) != 0; shift += 7) { + b = buffer[bufferPosition++]; + i |= (b & 0x7F) << shift; + } + return i; + } else { + return super.readVInt(); + } + } + + @Override + public long readVLong() throws IOException { + if (9 <= bufferLength-bufferPosition) { + byte b = buffer[bufferPosition++]; + long i = b & 0x7F; + for (int shift = 7; (b & 0x80) != 0; shift += 7) { + b = buffer[bufferPosition++]; + i |= (b & 0x7FL) << shift; + } + return i; + } else { + return super.readVLong(); + } + } + private void refill() throws IOException { long start = bufferStart + bufferPosition; long end = start + bufferSize; Index: lucene/src/java/org/apache/lucene/store/DataInput.java =================================================================== --- lucene/src/java/org/apache/lucene/store/DataInput.java (revision 1050777) +++ lucene/src/java/org/apache/lucene/store/DataInput.java (working copy) @@ -82,7 +82,7 @@ * supported. * @see DataOutput#writeVInt(int) */ - public final int readVInt() throws IOException { + public int readVInt() throws IOException { byte b = readByte(); int i = b & 0x7F; for (int shift = 7; (b & 0x80) != 0; shift += 7) { @@ -102,7 +102,7 @@ /** Reads a long stored in variable-length format. Reads between one and * nine bytes. Smaller values take fewer bytes. Negative numbers are not * supported. */ - public final long readVLong() throws IOException { + public long readVLong() throws IOException { byte b = readByte(); long i = b & 0x7F; for (int shift = 7; (b & 0x80) != 0; shift += 7) { Index: lucene/MIGRATE.txt =================================================================== --- lucene/MIGRATE.txt (revision 1050777) +++ lucene/MIGRATE.txt (working copy) @@ -324,7 +324,3 @@ The other way round MTQ.TopTermsBooleanQueryRewrite supplys a global AttributeSource to each segments TermsEnum. The TermsEnum is consumer and gets the current minimum competitive boosts (MTQ.MaxNonCompetitiveBoostAttribute). - -* LUCENE-2761: DataInput.readVInt/readVLong and DataOutput.writeVInt/writeVLong - are final. If you subclassed this code before to encode variable-length - integers in some specialized way, use the Codec API instead.