@Override public Folder getDefaultFolder() throws MessagingException { checkConnected(); return new DefaultFolder(this); }
/** * Only the name "INBOX" is supported. */ @Override public Folder getFolder(String name) throws MessagingException { checkConnected(); return new POP3Folder(this, name); }
/** * Return the raw results of the POP3 LIST command with no arguments. * * @return InputStream containing results * @exception IllegalStateException if the folder isn't open * @exception IOException for I/O errors talking to the server * @exception MessagingException for other errors * @since JavaMail 1.3.3 */ public synchronized InputStream listCommand() throws MessagingException, IOException { checkOpen(); return port.list(); }
/** * Issue a simple POP3 command and return the response. */ private Response simpleCommand(String cmd) throws IOException { simpleCommandStart(cmd); issueCommand(cmd); Response r = readResponse(); simpleCommandEnd(); return r; }
/** * Return the message header and the first n lines of the message. */ synchronized InputStream top(int msg, int n) throws IOException { Response r = multilineCommand("TOP " + msg + " " + n, 0); return r.bytes; }
/** * Centralize access to the Protocol object by POP3Message * objects so that they will fail appropriately when the folder * is closed. */ Protocol getProtocol() throws MessagingException { Protocol p = port; // read it before close() can set it to null checkOpen(); // close() might happen here return p; }
/** * Delete (permanently) the specified message. */ synchronized boolean dele(int msg) throws IOException { Response r = simpleCommand("DELE " + msg); return r.ok; }
/** * Will not change while the folder is open because the POP3 * protocol doesn't support notification of new messages * arriving in open folders. */ @Override public synchronized int getMessageCount() throws MessagingException { if (!opened) return -1; checkReadable(); return total; }
/** * Return the MIME format stream corresponding to this message part. * * @return the MIME format stream * @since JavaMail 1.4.5 */ public InputStream getMimeStream() throws MessagingException { return getRawStream(false); }
/** * Return a stream for appending to the temp file. */ public AppendStream getAppendStream() throws IOException { return sf.getAppendStream(); }
@Override public synchronized void close() throws IOException { end = tf.updateLength(); raf = null; // no more writing allowed }
/** * Returns email store. * * @param session {@link Session} * @return {@link com.sun.mail.pop3.POP3SSLStore} */ @Override protected POP3SSLStore getStore(final Session session) { final SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator; final URLName url; if (simpleAuthenticator == null) { url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, null, null); } else { final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication(); url = new URLName( PROTOCOL_POP3, host, port, StringPool.EMPTY, pa.getUserName(), pa.getPassword()); } return new POP3SSLStore(session, url); }
/** * Issue a simple POP3 command and return the response. */ private Response simpleCommand(String cmd) throws IOException { simpleCommandStart(cmd); issueCommand(cmd); Response r = readResponse(); simpleCommandEnd(); return r; }
public Folder getDefaultFolder() throws MessagingException { checkConnected(); return new DefaultFolder(this); }
/** * Only the name "INBOX" is supported. */ public Folder getFolder(String name) throws MessagingException { checkConnected(); return new POP3Folder(this, name); }
/** * Return the raw results of the POP3 LIST command with no arguments. * * @return InputStream containing results * @exception IllegalStateException if the folder isn't open * @exception IOException for I/O errors talking to the server * @exception MessagingException for other errors * @since JavaMail 1.3.3 */ public synchronized InputStream listCommand() throws MessagingException, IOException { checkOpen(); return port.list(); }
/** * Return the size of all messages using the LIST command. */ synchronized InputStream list() throws IOException { Response r = multilineCommand("LIST", 128); // 128 == output size est return r.bytes; }
/** * Return the size of this folder, as was returned by the POP3 STAT * command when this folder was opened. * * @return folder size * @exception IllegalStateException if the folder isn't open * @exception MessagingException for other failures */ public synchronized int getSize() throws MessagingException { checkOpen(); return size; }
/** * Do a NOOP. */ synchronized boolean noop() throws IOException { Response r = simpleCommand("NOOP"); return r.ok; }
this.store = ( protocol == MailConnectionMeta.PROTOCOL_POP3 ) ? new POP3SSLStore( this.session, url ) : new IMAPSSLStore( this.session, url ); url = null; } else {