1 21 22 27 28 package com.sun.mail.imap.protocol; 29 30 import java.io.ByteArrayInputStream ; 31 import com.sun.mail.iap.*; 32 import com.sun.mail.util.ASCIIUtility; 33 34 40 41 public class BODY implements Item { 42 43 public static char [] name = {'B','O','D','Y'}; 44 45 public int msgno; 46 public ByteArray data; 47 public String section; 48 public int origin = 0; 49 50 53 public BODY(FetchResponse r) throws ParsingException { 54 msgno = r.getNumber(); 55 56 r.skipSpaces(); 57 58 int b; 59 while ((b = r.readByte()) != ']') { if (b == 0) 61 throw new ParsingException( 62 "BODY parse error: missing ``]'' at section end"); 63 } 64 65 66 if (r.readByte() == '<') { origin = r.readNumber(); 68 r.skip(1); } 70 71 data = r.readByteArray(); 72 } 73 74 public ByteArray getByteArray() { 75 return data; 76 } 77 78 public ByteArrayInputStream getByteArrayInputStream() { 79 if (data != null) 80 return data.toByteArrayInputStream(); 81 else 82 return null; 83 } 84 } 85 | Popular Tags |