@Test public void testMultipleBodyResponses() throws Exception { IMAPProtocol p = new IMAPProtocol( new StringBufferInputStream(response), new PrintStream(new ByteArrayOutputStream()), new Properties(), debug); BODY b = p.fetchBody(1, "1.1"); assertEquals("section number", "1.1", b.getSection()); String result = new String(b.getByteArray().getNewBytes(), "us-ascii"); assertEquals("getByteArray.getNewBytes", content, result); InputStream is = b.getByteArrayInputStream(); byte[] ba = new byte[is.available()]; is.read(ba); result = new String(ba, "us-ascii"); assertEquals("getByteArrayInputStream", content, result); }
public BODY fetchBody(int msgno, String section) throws ProtocolException { return fetchBody(msgno, section, false); }
IMAPProtocol extends Protocol { public BODY fetchBody(int msgno, String section) throws ProtocolException { return fetchBody(msgno, section, false); } }
IMAPProtocol extends Protocol { public BODY fetchBody(int msgno, String section) throws ProtocolException { return fetchBody(msgno, section, false); } IMAPProtocol(String name, String host, int port, 
			Properties props, boolean isSSL, MailLogger logger);  IMAPProtocol(InputStream in, PrintStream out,
			Properties props, boolean debug); }
IMAPProtocol extends Protocol { public BODY fetchBody(int msgno, String section) throws ProtocolException { return fetchBody(msgno, section, false); } IMAPProtocol(String name, String host, int port, 
			Properties props, boolean isSSL, MailLogger logger);  IMAPProtocol(InputStream in, PrintStream out,
			Properties props, boolean debug); FetchItem[] getFetchItems(); void capability(); boolean isAuthenticated(); boolean isREV1(); Response readResponse(); boolean hasCapability(String c); Map getCapabilities(); void disconnect(); void noop(); void logout(); void login(String u, String p); synchronized void authlogin(String u, String p); synchronized void authplain(String authzid, String u, String p); synchronized void authntlm(String authzid, String u, String p); void sasllogin(String[] allowed, String realm, String authzid,
				String u, String p); void proxyauth(String u); String getProxyAuthUser(); void unauthenticate(); void id(String guid); void startTLS(); MailboxInfo select(String mbox); MailboxInfo select(String mbox, ResyncData rd); MailboxInfo examine(String mbox); MailboxInfo examine(String mbox, ResyncData rd); void enable(String cap); boolean isEnabled(String cap); void unselect(); Status status(String mbox, String[] items); void create(String mbox); void delete(String mbox); void rename(String o, String n); void subscribe(String mbox); void unsubscribe(String mbox); ListInfo[] list(String ref, String pattern); ListInfo[] lsub(String ref, String pattern); void append(String mbox, Flags f, Date d,
			Literal data); AppendUID appenduid(String mbox, Flags f, Date d,
			Literal data); AppendUID appenduid(String mbox, Flags f, Date d,
			Literal data, boolean uid); void check(); void close(); void expunge(); void uidexpunge(UIDSet[] set); BODYSTRUCTURE fetchBodyStructure(int msgno); BODY peekBody(int msgno, String section); BODY fetchBody(int msgno, String section); BODY peekBody(int msgno, String section, int start, int size); BODY fetchBody(int msgno, String section, int start, int size); BODY peekBody(int msgno, String section, int start, int size,
				ByteArray ba); BODY fetchBody(int msgno, String section, int start, int size,
				ByteArray ba); RFC822DATA fetchRFC822(int msgno, String what); Flags fetchFlags(int msgno); UID fetchUID(int msgno); MODSEQ fetchMODSEQ(int msgno); UID fetchSequenceNumber(long uid); UID[] fetchSequenceNumbers(long start, long end); UID[] fetchSequenceNumbers(long[] uids); int[] uidfetchChangedSince(long start, long end, long modseq); Response[] fetch(MessageSet[] msgsets, String what); Response[] fetch(int start, int end, String what); Response[] fetch(int msg, String what); void copy(MessageSet[] msgsets, String mbox); void copy(int start, int end, String mbox); CopyUID copyuid(MessageSet[] msgsets, String mbox); CopyUID copyuid(int start, int end, String mbox); CopyUID copyuid(String msgSequence, String mbox, boolean uid); void storeFlags(MessageSet[] msgsets, Flags flags, boolean set); void storeFlags(int start, int end, Flags flags, boolean set); void storeFlags(int msg, Flags flags, boolean set); int[] search(MessageSet[] msgsets, SearchTerm term); int[] search(SearchTerm term); int[] sort(SortTerm[] term, SearchTerm sterm); Namespaces namespace(); Quota[] getQuotaRoot(String mbox); Quota[] getQuota(String root); void setQuota(Quota quota); void setACL(String mbox, char modifier, ACL acl); void deleteACL(String mbox, String user); ACL[] getACL(String mbox); Rights[] listRights(String mbox, String user); Rights myRights(String mbox); synchronized void idleStart(); synchronized Response readIdleResponse(); boolean processIdleResponse(Response r); void idleAbort(); Map<String, String> id(Map<String, String> clientParams); }
IMAPProtocol extends Protocol { public BODY fetchBody(int msgno, String section) throws ProtocolException { return fetchBody(msgno, section, false); } IMAPProtocol(String name, String host, int port, 
			Properties props, boolean isSSL, MailLogger logger);  IMAPProtocol(InputStream in, PrintStream out,
			Properties props, boolean debug); FetchItem[] getFetchItems(); void capability(); boolean isAuthenticated(); boolean isREV1(); Response readResponse(); boolean hasCapability(String c); Map getCapabilities(); void disconnect(); void noop(); void logout(); void login(String u, String p); synchronized void authlogin(String u, String p); synchronized void authplain(String authzid, String u, String p); synchronized void authntlm(String authzid, String u, String p); void sasllogin(String[] allowed, String realm, String authzid,
				String u, String p); void proxyauth(String u); String getProxyAuthUser(); void unauthenticate(); void id(String guid); void startTLS(); MailboxInfo select(String mbox); MailboxInfo select(String mbox, ResyncData rd); MailboxInfo examine(String mbox); MailboxInfo examine(String mbox, ResyncData rd); void enable(String cap); boolean isEnabled(String cap); void unselect(); Status status(String mbox, String[] items); void create(String mbox); void delete(String mbox); void rename(String o, String n); void subscribe(String mbox); void unsubscribe(String mbox); ListInfo[] list(String ref, String pattern); ListInfo[] lsub(String ref, String pattern); void append(String mbox, Flags f, Date d,
			Literal data); AppendUID appenduid(String mbox, Flags f, Date d,
			Literal data); AppendUID appenduid(String mbox, Flags f, Date d,
			Literal data, boolean uid); void check(); void close(); void expunge(); void uidexpunge(UIDSet[] set); BODYSTRUCTURE fetchBodyStructure(int msgno); BODY peekBody(int msgno, String section); BODY fetchBody(int msgno, String section); BODY peekBody(int msgno, String section, int start, int size); BODY fetchBody(int msgno, String section, int start, int size); BODY peekBody(int msgno, String section, int start, int size,
				ByteArray ba); BODY fetchBody(int msgno, String section, int start, int size,
				ByteArray ba); RFC822DATA fetchRFC822(int msgno, String what); Flags fetchFlags(int msgno); UID fetchUID(int msgno); MODSEQ fetchMODSEQ(int msgno); UID fetchSequenceNumber(long uid); UID[] fetchSequenceNumbers(long start, long end); UID[] fetchSequenceNumbers(long[] uids); int[] uidfetchChangedSince(long start, long end, long modseq); Response[] fetch(MessageSet[] msgsets, String what); Response[] fetch(int start, int end, String what); Response[] fetch(int msg, String what); void copy(MessageSet[] msgsets, String mbox); void copy(int start, int end, String mbox); CopyUID copyuid(MessageSet[] msgsets, String mbox); CopyUID copyuid(int start, int end, String mbox); CopyUID copyuid(String msgSequence, String mbox, boolean uid); void storeFlags(MessageSet[] msgsets, Flags flags, boolean set); void storeFlags(int start, int end, Flags flags, boolean set); void storeFlags(int msg, Flags flags, boolean set); int[] search(MessageSet[] msgsets, SearchTerm term); int[] search(SearchTerm term); int[] sort(SortTerm[] term, SearchTerm sterm); Namespaces namespace(); Quota[] getQuotaRoot(String mbox); Quota[] getQuota(String root); void setQuota(Quota quota); void setACL(String mbox, char modifier, ACL acl); void deleteACL(String mbox, String user); ACL[] getACL(String mbox); Rights[] listRights(String mbox, String user); Rights myRights(String mbox); synchronized void idleStart(); synchronized Response readIdleResponse(); boolean processIdleResponse(Response r); void idleAbort(); Map<String, String> id(Map<String, String> clientParams);  }