make some fields private/final; add whitespace

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1357026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-07-04 00:43:04 +00:00
parent 1616749915
commit 21a6450e83
2 changed files with 30 additions and 16 deletions

View File

@ -67,21 +67,27 @@ public final class ForFactory extends IntStreamFactory {
// wrap input and output with buffer support // wrap input and output with buffer support
private class ForIndexInput extends FixedIntBlockIndexInput { private class ForIndexInput extends FixedIntBlockIndexInput {
ForIndexInput(final IndexInput in) throws IOException { ForIndexInput(final IndexInput in) throws IOException {
super(in); super(in);
} }
class ForBlockReader implements FixedIntBlockIndexInput.BlockReader { class ForBlockReader implements FixedIntBlockIndexInput.BlockReader {
byte[] encoded; private final byte[] encoded;
int[] buffer; private final int[] buffer;
IndexInput in; private final IndexInput in;
IntBuffer encodedBuffer; private final IntBuffer encodedBuffer;
ForBlockReader(final IndexInput in, final int[] buffer) { ForBlockReader(final IndexInput in, final int[] buffer) {
this.encoded = new byte[blockSize*8+4]; this.encoded = new byte[blockSize*8+4];
this.in = in; this.in = in;
this.buffer = buffer; this.buffer = buffer;
this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer(); this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer();
} }
public void seek(long pos) {}
public void seek(long pos) {
}
// TODO: implement public void skipBlock() {} ? // TODO: implement public void skipBlock() {} ?
public void readBlock() throws IOException { public void readBlock() throws IOException {
final int numBytes = in.readInt(); final int numBytes = in.readInt();
@ -90,6 +96,7 @@ public final class ForFactory extends IntStreamFactory {
ForUtil.decompress(encodedBuffer,buffer); ForUtil.decompress(encodedBuffer,buffer);
} }
} }
@Override @Override
protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException { protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException {
return new ForBlockReader(in,buffer); return new ForBlockReader(in,buffer);

View File

@ -67,21 +67,27 @@ public final class PForFactory extends IntStreamFactory {
// wrap input and output with buffer support // wrap input and output with buffer support
private class PForIndexInput extends FixedIntBlockIndexInput { private class PForIndexInput extends FixedIntBlockIndexInput {
PForIndexInput(final IndexInput in) throws IOException { PForIndexInput(final IndexInput in) throws IOException {
super(in); super(in);
} }
class PForBlockReader implements FixedIntBlockIndexInput.BlockReader { class PForBlockReader implements FixedIntBlockIndexInput.BlockReader {
byte[] encoded; private final byte[] encoded;
int[] buffer; private final int[] buffer;
IndexInput in; private final IndexInput in;
IntBuffer encodedBuffer; private final IntBuffer encodedBuffer;
PForBlockReader(final IndexInput in, final int[] buffer) { PForBlockReader(final IndexInput in, final int[] buffer) {
this.encoded = new byte[blockSize*8+4]; this.encoded = new byte[blockSize*8+4];
this.in = in; this.in = in;
this.buffer = buffer; this.buffer = buffer;
this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer(); this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer();
} }
public void seek(long pos) {}
public void seek(long pos) {
}
// TODO: implement public void skipBlock() {} ? // TODO: implement public void skipBlock() {} ?
public void readBlock() throws IOException { public void readBlock() throws IOException {
final int numBytes = in.readInt(); final int numBytes = in.readInt();
@ -90,6 +96,7 @@ public final class PForFactory extends IntStreamFactory {
PForUtil.decompress(encodedBuffer,buffer); PForUtil.decompress(encodedBuffer,buffer);
} }
} }
@Override @Override
protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException { protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException {
return new PForBlockReader(in,buffer); return new PForBlockReader(in,buffer);