Posts

Showing posts from August, 2020

compare two instants (month or other fields)

Duration duration = Duration.between(LocalDate.now().minusMonths(2).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant(),Instant.now()); System.out.println(duration.toDays());

get file from message - JavaMail library

get bytes BASE64DecoderStream base64DecoderStream = (BASE64DecoderStream) obj; byte[] byteArray = IOUtils.toByteArray(base64DecoderStream); byte[] encodeBase64 = Base64.encodeBase64(byteArray); ========= return inputstream for download process Resource <= InputStreamResource return new InputStreamResource(part.getInputStream());

receiver mail from server - IMAP - Java

Ilk once bize host, port, username ve password lazimdir. Host ve port serverden asili olaraq deyishe biler. Hal-hazir ki, numune gmail uchundur. [ get file from message ]