Package com.sun.mail.util
Class WriteTimeoutSocket
- java.lang.Object
-
- java.net.Socket
-
- com.sun.mail.util.WriteTimeoutSocket
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class WriteTimeoutSocket extends Socket
A special Socket that uses a ScheduledExecutorService to implement timeouts for writes. The write timeout is specified (in milliseconds) when the WriteTimeoutSocket is created.- Author:
- Bill Shannon
-
-
Constructor Summary
Constructors Constructor Description WriteTimeoutSocket(int timeout)WriteTimeoutSocket(String host, int port, int timeout)WriteTimeoutSocket(String host, int port, InetAddress localAddress, int localPort, int timeout)WriteTimeoutSocket(InetAddress address, int port, int timeout)WriteTimeoutSocket(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout)WriteTimeoutSocket(Socket socket, int timeout)
-
Method Summary
-
Methods inherited from class java.net.Socket
setSocketImplFactory
-
-
-
-
Constructor Detail
-
WriteTimeoutSocket
public WriteTimeoutSocket(Socket socket, int timeout) throws IOException
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(int timeout) throws IOException- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(InetAddress address, int port, int timeout) throws IOException
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout) throws IOException
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(String host, int port, int timeout) throws IOException
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(String host, int port, InetAddress localAddress, int localPort, int timeout) throws IOException
- Throws:
IOException
-
-
Method Detail
-
connect
public void connect(SocketAddress remote) throws IOException
- Overrides:
connectin classSocket- Throws:
IOException
-
connect
public void connect(SocketAddress remote, int timeout) throws IOException
- Overrides:
connectin classSocket- Throws:
IOException
-
bind
public void bind(SocketAddress local) throws IOException
- Overrides:
bindin classSocket- Throws:
IOException
-
getRemoteSocketAddress
public SocketAddress getRemoteSocketAddress()
- Overrides:
getRemoteSocketAddressin classSocket
-
getLocalSocketAddress
public SocketAddress getLocalSocketAddress()
- Overrides:
getLocalSocketAddressin classSocket
-
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth)- Overrides:
setPerformancePreferencesin classSocket
-
getChannel
public SocketChannel getChannel()
- Overrides:
getChannelin classSocket
-
getInetAddress
public InetAddress getInetAddress()
- Overrides:
getInetAddressin classSocket
-
getLocalAddress
public InetAddress getLocalAddress()
- Overrides:
getLocalAddressin classSocket
-
getLocalPort
public int getLocalPort()
- Overrides:
getLocalPortin classSocket
-
getInputStream
public InputStream getInputStream() throws IOException
- Overrides:
getInputStreamin classSocket- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
- Overrides:
getOutputStreamin classSocket- Throws:
IOException
-
setTcpNoDelay
public void setTcpNoDelay(boolean on) throws SocketException- Overrides:
setTcpNoDelayin classSocket- Throws:
SocketException
-
getTcpNoDelay
public boolean getTcpNoDelay() throws SocketException- Overrides:
getTcpNoDelayin classSocket- Throws:
SocketException
-
setSoLinger
public void setSoLinger(boolean on, int linger) throws SocketException- Overrides:
setSoLingerin classSocket- Throws:
SocketException
-
getSoLinger
public int getSoLinger() throws SocketException- Overrides:
getSoLingerin classSocket- Throws:
SocketException
-
sendUrgentData
public void sendUrgentData(int data) throws IOException- Overrides:
sendUrgentDatain classSocket- Throws:
IOException
-
setOOBInline
public void setOOBInline(boolean on) throws SocketException- Overrides:
setOOBInlinein classSocket- Throws:
SocketException
-
getOOBInline
public boolean getOOBInline() throws SocketException- Overrides:
getOOBInlinein classSocket- Throws:
SocketException
-
setSoTimeout
public void setSoTimeout(int timeout) throws SocketException- Overrides:
setSoTimeoutin classSocket- Throws:
SocketException
-
getSoTimeout
public int getSoTimeout() throws SocketException- Overrides:
getSoTimeoutin classSocket- Throws:
SocketException
-
setSendBufferSize
public void setSendBufferSize(int size) throws SocketException- Overrides:
setSendBufferSizein classSocket- Throws:
SocketException
-
getSendBufferSize
public int getSendBufferSize() throws SocketException- Overrides:
getSendBufferSizein classSocket- Throws:
SocketException
-
setReceiveBufferSize
public void setReceiveBufferSize(int size) throws SocketException- Overrides:
setReceiveBufferSizein classSocket- Throws:
SocketException
-
getReceiveBufferSize
public int getReceiveBufferSize() throws SocketException- Overrides:
getReceiveBufferSizein classSocket- Throws:
SocketException
-
setKeepAlive
public void setKeepAlive(boolean on) throws SocketException- Overrides:
setKeepAlivein classSocket- Throws:
SocketException
-
getKeepAlive
public boolean getKeepAlive() throws SocketException- Overrides:
getKeepAlivein classSocket- Throws:
SocketException
-
setTrafficClass
public void setTrafficClass(int tc) throws SocketException- Overrides:
setTrafficClassin classSocket- Throws:
SocketException
-
getTrafficClass
public int getTrafficClass() throws SocketException- Overrides:
getTrafficClassin classSocket- Throws:
SocketException
-
setReuseAddress
public void setReuseAddress(boolean on) throws SocketException- Overrides:
setReuseAddressin classSocket- Throws:
SocketException
-
getReuseAddress
public boolean getReuseAddress() throws SocketException- Overrides:
getReuseAddressin classSocket- Throws:
SocketException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSocket- Throws:
IOException
-
shutdownInput
public void shutdownInput() throws IOException- Overrides:
shutdownInputin classSocket- Throws:
IOException
-
shutdownOutput
public void shutdownOutput() throws IOException- Overrides:
shutdownOutputin classSocket- Throws:
IOException
-
isConnected
public boolean isConnected()
- Overrides:
isConnectedin classSocket
-
isInputShutdown
public boolean isInputShutdown()
- Overrides:
isInputShutdownin classSocket
-
isOutputShutdown
public boolean isOutputShutdown()
- Overrides:
isOutputShutdownin classSocket
-
setOption
public <T> Socket setOption(SocketOption<T> so, T val) throws IOException
- Overrides:
setOptionin classSocket- Throws:
IOException
-
getOption
public <T> T getOption(SocketOption<T> so) throws IOException
- Overrides:
getOptionin classSocket- Throws:
IOException
-
supportedOptions
public Set<SocketOption<?>> supportedOptions()
- Overrides:
supportedOptionsin classSocket
-
getFileDescriptor$
public FileDescriptor getFileDescriptor$()
KLUDGE for Android, which has this illegal non-Java Compatible method.- Returns:
- the FileDescriptor object
-
-