मैं वर्तमान में एक एप्लिकेशन विकसित कर रहा हूं जो जीमेल खाते से अनुलग्नक डाउनलोड करता है। अभी, ज़िप्ड अटैचमेंट डाउनलोड करते समय मुझे त्रुटि मिली। लेकिन, सब कुछ नहीं, कुछ मैं बिना किसी त्रुटि के इसे पुनर्प्राप्त कर सकता हूं। यहां अपवाद संदेश है:जावामेल बेसएनकोड 64 त्रुटि
Exception in thread "main" com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed 4 valid base64 characters but only got 1 before EOF, the 10 most recent characters were: "Q3w5ilxj2P"
FYI: मैं जीमेल वेब इंटरफ़ेस के माध्यम से अनुलग्नक डाउनलोड करने में सक्षम था।
Multipart multipart = (Multipart) message.getContent();
for (int i = 0; i < multipart.getCount(); i++) {
BodyPart bodyPart = multipart.getBodyPart(i);
if (bodyPart.getFileName().toLowerCase().endsWith("zip") ||
bodyPart.getFileName().toLowerCase().endsWith("rar")) {
InputStream is = bodyPart.getInputStream();
File f = new File("/tmp/" + bodyPart.getFileName());
FileOutputStream fos = new FileOutputStream(f);
byte[] buf = new byte[bodyPart.getSize()];
int bytesRead;
while ((bytesRead = is.read(buf)) != -1) {
fos.write(buf, 0, bytesRead);
}
fos.close();
}
}
}
किसी को भी पता नहीं है, कैसे इस समस्या को हल करने के लिए:
यहाँ टुकड़ा है?
इस के साथ कोई भाग्य अभी तक? – William
नहीं, अभी तक नहीं। लगता है। कोई भी जावा मेल में रूचि नहीं रखता है :( – ariefbayu