## org.compiere.utils
Class DigestOfFile

    java.lang.Object
      org.compiere.utils.DigestOfFile

public class DigestOfFile
extends java.lang.Object

Author:
  rlemeill

Field Summary
`private sun.misc.BASE64Encoder` `base64Encoder`
`private byte[]` `buffer`
`private java.security.MessageDigest` `digestAgent`
`private static char[]` `HEX_CHARS`

Constructor Summary
`DigestOfFile(java.lang.String mode)`

Method Summary
`java.lang.String` `digestAsBase64(java.io.File file)`
`byte[]` `digestAsByteArray(java.io.File file)`
`static java.lang.String` `GetLocalMD5Hash(java.io.File file)`
`static void` `main(java.lang.String[] args)`
`static boolean` `md5localHashCompare(java.io.File file1, java.io.File file2)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HEX_CHARS

    private static final char[] HEX_CHARS

### digestAgent

    private java.security.MessageDigest digestAgent

### base64Encoder

    private sun.misc.BASE64Encoder base64Encoder

### buffer

    private byte[] buffer

Constructor Detail

### DigestOfFile

    public DigestOfFile(java.lang.String mode)
                 throws java.lang.Exception

Parameters:
  `mode` - ie MD5
Throws:
  `java.lang.Exception`

Method Detail

### digestAsByteArray

    public byte[] digestAsByteArray(java.io.File file)
                             throws java.lang.Exception

  Parameters:
    `file` - to hash
  Returns:
    hash
  Throws:
    `java.lang.Exception`

### digestAsBase64

    public java.lang.String digestAsBase64(java.io.File file)
                                    throws java.lang.Exception

  Parameters:
    `file` -
  Returns:
    hash (base64 encoded)
  Throws:
    `java.lang.Exception`

### main

    public static void main(java.lang.String[] args)

  Parameters:
    `args` - file

### md5localHashCompare

    public static boolean md5localHashCompare(java.io.File file1,
                                              java.io.File file2)

  Parameters:
    `file1` - first file to compare
    `file2` - second file to compare
  Returns:
    true if files are identic false otherwise

### GetLocalMD5Hash

    public static java.lang.String GetLocalMD5Hash(java.io.File file)

  Parameters:
    `file` -
  Returns:
    md5 hash null if file is not found or other error