Bonjour,
J'essaye de lire des mails en Java.
Mais lorsque je récupère le body du mail j'obtiens un objet de type : SharedByteArrayInputStream
Comment le convertir en String ? svp.
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public static String convert_content_toString(javax.mail.Message msg) throws IOException, MessagingException { String msg_content = ""; if (msg.getContent() instanceof String) { msg_content = msg.getContent().toString(); } if (msg.getContent() instanceof SharedByteArrayInputStream) { // Convertir en String } return msg_content; }
Partager