public class IMAP extends SocketClient
Modifier and Type | Class and Description |
---|---|
static class |
IMAP.IMAPState |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
__DEFAULT_ENCODING
The default control socket ecoding.
|
protected java.io.BufferedWriter |
__writer |
protected java.io.BufferedReader |
_reader |
static int |
DEFAULT_PORT
The default IMAP port (RFC 3501).
|
_defaultPort_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL
Constructor and Description |
---|
IMAP()
The default IMAPClient constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_connectAction_()
Performs connection initialization and sets state to
IMAP.IMAPState.NOT_AUTH_STATE . |
void |
disconnect()
Disconnects the client from the server, and sets the state to
DISCONNECTED_STATE . |
boolean |
doCommand(IMAPCommand command)
Sends a command to the server and return whether successful.
|
boolean |
doCommand(IMAPCommand command,
java.lang.String args)
Sends a command and arguments to the server and return whether successful.
|
protected java.lang.String |
generateCommandID()
Generates a new command ID (tag) for a command.
|
java.lang.String |
getReplyString()
Returns the reply to the last command sent to the server.
|
java.lang.String[] |
getReplyStrings()
Returns an array of lines received as a reply to the last command
sent to the server.
|
IMAP.IMAPState |
getState()
Returns the current IMAP client state.
|
int |
sendCommand(IMAPCommand command)
Sends a command with no arguments to the server and returns the
reply code.
|
int |
sendCommand(IMAPCommand command,
java.lang.String args)
Sends a command and arguments to the server and returns the reply code.
|
int |
sendCommand(java.lang.String command)
Sends a command with no arguments to the server and returns the
reply code.
|
int |
sendCommand(java.lang.String command,
java.lang.String args)
Sends a command an arguments to the server and returns the reply code.
|
int |
sendData(java.lang.String command)
Sends data to the server and returns the reply code.
|
protected void |
setState(IMAP.IMAPState state)
Sets IMAP client state.
|
addProtocolCommandListener, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCommandSupport, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getReceiveBufferSize, getRemoteAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
public static final int DEFAULT_PORT
protected static final java.lang.String __DEFAULT_ENCODING
protected java.io.BufferedWriter __writer
protected java.io.BufferedReader _reader
public IMAP()
DISCONNECTED_STATE
.protected void _connectAction_() throws java.io.IOException
IMAP.IMAPState.NOT_AUTH_STATE
._connectAction_
in class SocketClient
java.io.IOException
protected void setState(IMAP.IMAPState state)
_STATE
constants.
state
- The new state.public IMAP.IMAPState getState()
public void disconnect() throws java.io.IOException
DISCONNECTED_STATE
. The reply text information
from the last issued command is voided to allow garbage collection
of the memory used to store that information.
disconnect
in class SocketClient
java.io.IOException
- If there is an error in disconnecting.public int sendCommand(java.lang.String command, java.lang.String args) throws java.io.IOException
command
- The IMAP command to send.args
- The command arguments.java.io.IOException
public int sendCommand(java.lang.String command) throws java.io.IOException
command
- The IMAP command to send.java.io.IOException
public int sendCommand(IMAPCommand command, java.lang.String args) throws java.io.IOException
command
- The IMAP command to send
(one of the IMAPCommand constants).args
- The command arguments.java.io.IOException
public boolean doCommand(IMAPCommand command, java.lang.String args) throws java.io.IOException
command
- The IMAP command to send
(one of the IMAPCommand constants).args
- The command arguments.true
if the command was successfuljava.io.IOException
public int sendCommand(IMAPCommand command) throws java.io.IOException
command
- The IMAP command to send
(one of the IMAPCommand constants).java.io.IOException
public boolean doCommand(IMAPCommand command) throws java.io.IOException
command
- The IMAP command to send
(one of the IMAPCommand constants).true
if the command was successfuljava.io.IOException
public int sendData(java.lang.String command) throws java.io.IOException
command
- The IMAP command to send.java.io.IOException
public java.lang.String[] getReplyStrings()
public java.lang.String getReplyString()
protected java.lang.String generateCommandID()
Copyright © 2001-2012 Apache Software Foundation. All Rights Reserved.