Class MD5Digester
java.lang.Object
com.perforce.p4java.impl.mapbased.rpc.func.helper.MD5Digester
Provide 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 -
Method Summary
Modifier and TypeMethodDescriptionReturn the finalised digest as a 32 byte hex string.byte[]digestFileAs32ByteHex(File file) Return the results of digesting an arbitrary file with this digester.digestFileAs32ByteHex(File file, Charset charset) Return the results of digesting an arbitrary file with this digester.digestFileAs32ByteHex(File file, Charset charset, boolean doesNeedConvertLineEndings) Return the results of digesting an arbitrary file with this digester.digestFileAs32ByteHex(File file, Charset charset, boolean isRequireLineEndingConvert, ClientLineEnding clientLineEnding) Return the results of digesting an arbitrary file with this digester and a specific client line ending.longvoidreset()voidupdate(byte[] bytes) voidupdate(byte[] bytes, int off, int len) void
-
Constructor Details
-
MD5Digester
- Throws:
P4JavaError
-
MD5Digester
public MD5Digester(@Nonnull int bufferSize)
-
-
Method Details
-
digestAsBytes
public byte[] digestAsBytes() -
digestFileAs32ByteHex
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
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
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 String digestFileAs32ByteHex(@Nonnull File file, @Nullable 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 String digestFileAs32ByteHex(@Nonnull File file, @Nullable 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
-
update
public void update(byte[] bytes) -
getByteCount
public long getByteCount()
-