public class Digest extends Object
| Constructor and Description |
|---|
Digest(DigestType algo)
Create one DigestLight
|
Digest(String digest,
DigestType algo)
Create one DigestLight from parameter
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
digest() |
static Digest |
digest(File in,
DigestType algo) |
static Digest |
digest(InputStream in,
DigestType algo) |
String |
digest64() |
String |
digestHex() |
boolean |
equals(Object obj) |
boolean |
equalsWithType(byte[] digest,
DigestType algo) |
boolean |
equalsWithType(String digest,
DigestType algo) |
InputStream |
getDigestInputStream(InputStream inputStream)
Will update the Digest while the returned InputStream will be read
|
int |
hashCode() |
Digest |
reset()
Reset the DigestLight
|
String |
toString() |
DigestType |
type() |
Digest |
update(byte[] bytes) |
Digest |
update(byte[] bytes,
int offset,
int length) |
Digest |
update(ByteBuffer buffer) |
Digest |
update(File in) |
Digest |
update(FileChannel fileChannelInputStream) |
Digest |
update(FileChannel fileChannelInputStream,
long start,
int chunkSize,
long limit) |
Digest |
update(File in,
long start,
long limit) |
Digest |
update(InputStream inputStream) |
Digest |
update(InputStream inputStream,
int chunkSize) |
Digest |
update(InputStream inputStream,
int chunkSize,
long limit) |
Digest |
update(String value) |
public Digest(DigestType algo)
algo - the algorithm to useIllegalArgumentException - if null or unknown algorithmpublic Digest(String digest, DigestType algo)
digest - as String to createalgo - the algorithm to useIllegalArgumentException - if null or unknown algorithm or if digest is null or emptypublic final DigestType type()
public final Digest update(byte[] bytes)
bytes - the bytes from which to updateIllegalArgumentException - if bytes nullpublic final Digest update(byte[] bytes, int offset, int length)
bytes - the bytes from which to updateoffset - the offset positionlength - the lengthIllegalArgumentException - if bytes null, offset < 0, length < 0public final Digest update(ByteBuffer buffer)
buffer - for updating DigestIllegalArgumentException - if buffer nullpublic final Digest update(String value)
value - the String value from which to updateIllegalArgumentException - value nullpublic final Digest update(File in) throws IOException
in - the file from which to updateIOException - if any IO error occursIllegalArgumentException - in nullpublic final Digest update(File in, long start, long limit) throws IOException
in - the file from which to updatestart - the position to startlimit - if less than 0, means allIOException - if any IO error occursIllegalArgumentException - in null, start < 0public final Digest update(InputStream inputStream) throws IOException
inputStream - the inputstream from which to update using default chunksizeIOException - if any IO error occursIllegalArgumentException - inputstream nullpublic final Digest update(InputStream inputStream, int chunkSize) throws IOException
inputStream - the inputstream from which to updatechunkSize - the chunksize to useIOException - if any IO error occursIllegalArgumentException - inputstream null, chunksize < 1public final Digest update(InputStream inputStream, int chunkSize, long limit) throws IOException
inputStream - the inputstream from which to updatechunkSize - the chunksize to uselimit - if less than 0, means allIOException - if any IO error occursIllegalArgumentException - inputstream null, chunksize < 1public final Digest update(FileChannel fileChannelInputStream) throws IOException
fileChannelInputStream - the FileChannel inputstream from which to updateIOException - if any IO error occursIllegalArgumentException - fileChannelIinputStream nullpublic final Digest update(FileChannel fileChannelInputStream, long start, int chunkSize, long limit) throws IOException
fileChannelInputStream - the FileChannel inputstream from which to updatestart - the position to startchunkSize - the chunksize to uselimit - if less than 0, means allIOException - if any IO error occursIllegalArgumentException - fileChannelIinputStream null, start < 0, chunksize < 1public InputStream getDigestInputStream(InputStream inputStream)
inputStream - from which the data to digest will be donepublic final Digest reset()
public final byte[] digest()
public final String digestHex()
public final String digest64()
public final boolean equalsWithType(String digest, DigestType algo)
digest - the digest to compare toalgo - the associated algorithmpublic final boolean equalsWithType(byte[] digest,
DigestType algo)
digest - the digest in byte to usealgo - the associated algorithmpublic static final Digest digest(InputStream in, DigestType algo) throws IOException
in - the inputstream from which the digest will be computedalgo - the algorithm to useIOException - if any IO error occursIllegalArgumentException - in or algo nullpublic static final Digest digest(File in, DigestType algo) throws IOException
in - the file from which the digest will be computedalgo - the algorithm to useIOException - if any IO error occursIllegalArgumentException - in or algo nullCopyright © 2018 Vitam. All rights reserved.