Example usage for org.springframework.security.crypto.codec Hex Hex

List of usage examples for org.springframework.security.crypto.codec Hex Hex

Introduction

In this page you can find the example usage for org.springframework.security.crypto.codec Hex Hex.

Prototype

Hex

Source Link

Usage

From source file:de.inren.service.picture.PictureModificationServiceImpl.java

public void initPictureModificationService() {
    Application.get().getSharedResources().add(PictureResource.PICTURE_RESOURCE, new PictureResource());
    final File file = storehouseService.getDataFile(PictureModificationService.FILE_NOT_FOUND_DIGEST);
    if (!file.exists()) {
        InputStream is = PictureModificationServiceImpl.class
                .getResourceAsStream(PictureModificationService.FILE_NOT_FOUND_NAME);
        final Hex hex = new Hex();
        byte[] md5sum;
        md5sum = (byte[]) hex.decode(PictureModificationService.FILE_NOT_FOUND_DIGEST);
        // prescale to thumbnail, also test for converter
        storehouseService.doImport(is, md5sum);
        File thumbFile = getThumbnailImage(PictureModificationService.FILE_NOT_FOUND_DIGEST);
        log.info("picture modification service \"File not found\" image imported");
        try {//from   w w w  . java 2s. c  o m
            log.info("Mimetype of " + thumbFile.getName() + " is " + Files.probeContentType(file.toPath()));
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }

    } else {
        try {
            log.info("Mimetype of " + PictureModificationService.FILE_NOT_FOUND_NAME + " is "
                    + Files.probeContentType(file.toPath()));
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
    }
}

From source file:de.inren.service.storehouse.StorehouseServiceImpl.java

private String toHexString(byte[] md5hashAsByteArray) {
    final Hex hex = new Hex();
    return new String(hex.encode(md5hashAsByteArray));
}