Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void save(FileUploadEvent event) throws IOException {
- HashCode hashCode = null;
- HashCode hashCodeCompare = null;
- hashCode = Files.asByteSource(new File(event.toString())).hash(Hashing.murmur3_128(50));
- hashCodeCompare = Files.asByteSource(new File(FilePathOfFileToCompare)).hash(Hashing.murmur3_128(50));
- boolean hashTrueFalse;
- if(hashCode.equals(hashCodeCompare)) {
- System.out.println("true");
- } else{
- System.out.println("false");
- }
- try (InputStream input = event.getFile().getInputstream()) {
- String imageName = generateFileName() + "." + fileExtensions(event.getFile().getFileName());
- String imageLink = PICTURE_DESTINATION + "\" + imageName;
- Picture picture = new Picture();
- picture.setPictureUrl(imageLink);
- pictureService.createOrUpdate(picture);
- personForm.getCurrentPersonDTO().setPictureDTO(pictureMapper.toDTO(picture));
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment