daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void save(FileUploadEvent event) throws IOException {
  2.         HashCode hashCode = null;
  3.         HashCode hashCodeCompare = null;
  4.         hashCode = Files.asByteSource(new File(event.toString())).hash(Hashing.murmur3_128(50));
  5.         hashCodeCompare = Files.asByteSource(new File(FilePathOfFileToCompare)).hash(Hashing.murmur3_128(50));
  6.         boolean hashTrueFalse;
  7.         if(hashCode.equals(hashCodeCompare)) {
  8.             System.out.println("true");
  9.         } else{
  10.             System.out.println("false");
  11.         }
  12.  
  13.         try (InputStream input = event.getFile().getInputstream()) {
  14.             String imageName = generateFileName() + "." + fileExtensions(event.getFile().getFileName());
  15.             String imageLink = PICTURE_DESTINATION + "\" + imageName;
  16.  
  17.  
  18.             Picture picture = new Picture();
  19.             picture.setPictureUrl(imageLink);
  20.             pictureService.createOrUpdate(picture);
  21.  
  22.             personForm.getCurrentPersonDTO().setPictureDTO(pictureMapper.toDTO(picture));
  23.  
  24.  
  25.         } catch (IOException e) {
  26.             e.printStackTrace();
  27.         }
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top