Package org.apache.lucene.store
Class BufferedChecksum
- java.lang.Object
-
- org.apache.lucene.store.BufferedChecksum
-
- All Implemented Interfaces:
java.util.zip.Checksum
public class BufferedChecksum extends java.lang.Object implements java.util.zip.Checksum
Wraps anotherChecksum
with an internal buffer to speed up checksum calculations.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
buffer
static int
DEFAULT_BUFFERSIZE
Default buffer size: 1024private java.util.zip.Checksum
in
private int
upto
-
Constructor Summary
Constructors Constructor Description BufferedChecksum(java.util.zip.Checksum in)
Create a new BufferedChecksum withDEFAULT_BUFFERSIZE
BufferedChecksum(java.util.zip.Checksum in, int bufferSize)
Create a new BufferedChecksum with the specified bufferSize
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
flush()
long
getValue()
void
reset()
void
update(byte[] b, int off, int len)
void
update(int b)
-
-
-
Field Detail
-
in
private final java.util.zip.Checksum in
-
buffer
private final byte[] buffer
-
upto
private int upto
-
DEFAULT_BUFFERSIZE
public static final int DEFAULT_BUFFERSIZE
Default buffer size: 1024- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BufferedChecksum
public BufferedChecksum(java.util.zip.Checksum in)
Create a new BufferedChecksum withDEFAULT_BUFFERSIZE
-
BufferedChecksum
public BufferedChecksum(java.util.zip.Checksum in, int bufferSize)
Create a new BufferedChecksum with the specified bufferSize
-
-
Method Detail
-
update
public void update(int b)
- Specified by:
update
in interfacejava.util.zip.Checksum
-
update
public void update(byte[] b, int off, int len)
- Specified by:
update
in interfacejava.util.zip.Checksum
-
getValue
public long getValue()
- Specified by:
getValue
in interfacejava.util.zip.Checksum
-
reset
public void reset()
- Specified by:
reset
in interfacejava.util.zip.Checksum
-
flush
private void flush()
-
-