Class MD5Digester
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.rpc.func.helper.MD5Digester
-
public class MD5Digester extends java.lang.ObjectProvide MD5 digest methods for the rest of the RPC implementation. Basically just a wrapper around the normal Java stuff, with a useful added method to finalise the digest as a hex string.
-
-
Constructor Summary
Constructors Constructor Description MD5Digester()MD5Digester(int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringdigestAs32ByteHex()Return the finalised digest as a 32 byte hex string.byte[]digestAsBytes()java.lang.StringdigestFileAs32ByteHex(java.io.File file)Return the results of digesting an arbitrary file with this digester.java.lang.StringdigestFileAs32ByteHex(java.io.File file, java.nio.charset.Charset charset)Return the results of digesting an arbitrary file with this digester.java.lang.StringdigestFileAs32ByteHex(java.io.File file, java.nio.charset.Charset charset, boolean doesNeedConvertLineEndings)Return the results of digesting an arbitrary file with this digester.java.lang.StringdigestFileAs32ByteHex(java.io.File file, java.nio.charset.Charset charset, boolean isRequireLineEndingConvert, ClientLineEnding clientLineEnding)Return the results of digesting an arbitrary file with this digester and a specific client line ending.longgetByteCount()voidreset()voidupdate(byte[] bytes)voidupdate(byte[] bytes, int off, int len)voidupdate(java.lang.String str)
-
-
-
Constructor Detail
-
MD5Digester
public MD5Digester() throws P4JavaError- Throws:
P4JavaError
-
MD5Digester
public MD5Digester(@Nonnull int bufferSize)
-
-
Method Detail
-
digestAsBytes
public byte[] digestAsBytes()
-
digestFileAs32ByteHex
@Nullable public java.lang.String digestFileAs32ByteHex(@Nonnull java.io.File file)Return the results of digesting an arbitrary file with this digester.Returns null if it can't read or digest the file for whatever reason; otherwise the finalized digest is returned as a 32 byte hex string.
- Parameters:
file- file- Returns:
- - computed digest or null if computation failed
-
reset
public void reset()
-
update
public void update(byte[] bytes, int off, int len)
-
digestAs32ByteHex
public java.lang.String digestAs32ByteHex()
Return the finalised digest as a 32 byte hex string. It's important elsewhere and in the server that the string be exactly 32 bytes long, so we stitch it up if possible to make it that long...- Returns:
- digest
-
digestFileAs32ByteHex
@Nullable public java.lang.String digestFileAs32ByteHex(@Nonnull java.io.File file, @Nullable java.nio.charset.Charset charset)Return the results of digesting an arbitrary file with this digester.Returns null if it can't read or digest the file for whatever reason; otherwise the finalized digest is returned as a 32 byte hex string.
- Parameters:
file- filecharset- charset- Returns:
- - computed digest or null if computation failed
-
digestFileAs32ByteHex
@Nullable public java.lang.String digestFileAs32ByteHex(@Nonnull java.io.File file, @Nullable java.nio.charset.Charset charset, boolean doesNeedConvertLineEndings)Return the results of digesting an arbitrary file with this digester.Returns null if it can't read or digest the file for whatever reason; otherwise the finalized digest is returned as a 32 byte hex string.
- Parameters:
file- filecharset- charsetdoesNeedConvertLineEndings- doesNeedConvertLineEndings- Returns:
- - computed digest or null if computation failed
-
digestFileAs32ByteHex
@Nullable public java.lang.String digestFileAs32ByteHex(@Nonnull java.io.File file, @Nullable java.nio.charset.Charset charset, boolean isRequireLineEndingConvert, @Nullable ClientLineEnding clientLineEnding)Return the results of digesting an arbitrary file with this digester and a specific client line ending.Returns null if it can't read or digest the file for whatever reason; otherwise the finalized digest is returned as a 32 byte hex string.
- Parameters:
file- filecharset- charsetisRequireLineEndingConvert- isRequireLineEndingConvertclientLineEnding- clientLineEnding- Returns:
- - computed digest or null if computation failed
-
update
public void update(java.lang.String str)
-
update
public void update(byte[] bytes)
-
getByteCount
public long getByteCount()
-
-