]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.spring/src/org/argeo/slc/core/deploy/DigestCheck.java
1 package org
.argeo
.slc
.core
.deploy
;
4 import java
.io
.IOException
;
6 import org
.argeo
.slc
.SlcException
;
7 import org
.springframework
.core
.io
.Resource
;
8 import org
.springframework
.util
.DigestUtils
;
10 /** Add Spring capabilities to {@link DigestUtils} */
11 public class DigestCheck
extends DigestUtils
{
12 public static String
digest(String algorithm
, Resource resource
) {
14 File file
= resource
.getFile();
15 return org
.argeo
.util
.DigestUtils
.digest(algorithm
, file
);
16 } catch (IOException e
) {
18 return org
.argeo
.util
.DigestUtils
.digest(algorithm
,
19 resource
.getInputStream());
20 } catch (IOException e1
) {
21 throw new SlcException("Cannot digest " + resource
22 + " with algorithm " + algorithm
, e
);