Package com.sun.mail.util
Class WriteTimeoutSocket
java.lang.Object
java.net.Socket
com.sun.mail.util.WriteTimeoutSocket
- All Implemented Interfaces:
Closeable,AutoCloseable
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
ConstructorsConstructorDescriptionWriteTimeoutSocket(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
Modifier and TypeMethodDescriptionvoidbind(SocketAddress local) voidclose()voidconnect(SocketAddress remote) voidconnect(SocketAddress remote, int timeout) KLUDGE for Android, which has this illegal non-Java Compatible method.booleanintboolean<T> TgetOption(SocketOption<T> so) intgetPort()intbooleanintintintbooleanintbooleanisBound()booleanisClosed()booleanbooleanbooleanvoidsendUrgentData(int data) voidsetKeepAlive(boolean on) voidsetOOBInline(boolean on) <T> SocketsetOption(SocketOption<T> so, T val) voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth) voidsetReceiveBufferSize(int size) voidsetReuseAddress(boolean on) voidsetSendBufferSize(int size) voidsetSoLinger(boolean on, int linger) voidsetSoTimeout(int timeout) voidsetTcpNoDelay(boolean on) voidsetTrafficClass(int tc) voidvoidSet<SocketOption<?>>toString()Methods inherited from class java.net.Socket
setSocketImplFactory
-
Constructor Details
-
WriteTimeoutSocket
- Throws:
IOException
-
WriteTimeoutSocket
- Throws:
IOException
-
WriteTimeoutSocket
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout) throws IOException - Throws:
IOException
-
WriteTimeoutSocket
- Throws:
IOException
-
WriteTimeoutSocket
public WriteTimeoutSocket(String host, int port, InetAddress localAddress, int localPort, int timeout) throws IOException - Throws:
IOException
-
-
Method Details
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
bind
- Overrides:
bindin classSocket- Throws:
IOException
-
getRemoteSocketAddress
- Overrides:
getRemoteSocketAddressin classSocket
-
getLocalSocketAddress
- Overrides:
getLocalSocketAddressin classSocket
-
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) - Overrides:
setPerformancePreferencesin classSocket
-
getChannel
- Overrides:
getChannelin classSocket
-
getInetAddress
- Overrides:
getInetAddressin classSocket
-
getLocalAddress
- Overrides:
getLocalAddressin classSocket
-
getPort
public int getPort() -
getLocalPort
public int getLocalPort()- Overrides:
getLocalPortin classSocket
-
getInputStream
- Overrides:
getInputStreamin classSocket- Throws:
IOException
-
getOutputStream
- Overrides:
getOutputStreamin classSocket- Throws:
IOException
-
setTcpNoDelay
- Overrides:
setTcpNoDelayin classSocket- Throws:
SocketException
-
getTcpNoDelay
- Overrides:
getTcpNoDelayin classSocket- Throws:
SocketException
-
setSoLinger
- Overrides:
setSoLingerin classSocket- Throws:
SocketException
-
getSoLinger
- Overrides:
getSoLingerin classSocket- Throws:
SocketException
-
sendUrgentData
- Overrides:
sendUrgentDatain classSocket- Throws:
IOException
-
setOOBInline
- Overrides:
setOOBInlinein classSocket- Throws:
SocketException
-
getOOBInline
- Overrides:
getOOBInlinein classSocket- Throws:
SocketException
-
setSoTimeout
- Overrides:
setSoTimeoutin classSocket- Throws:
SocketException
-
getSoTimeout
- Overrides:
getSoTimeoutin classSocket- Throws:
SocketException
-
setSendBufferSize
- Overrides:
setSendBufferSizein classSocket- Throws:
SocketException
-
getSendBufferSize
- Overrides:
getSendBufferSizein classSocket- Throws:
SocketException
-
setReceiveBufferSize
- Overrides:
setReceiveBufferSizein classSocket- Throws:
SocketException
-
getReceiveBufferSize
- Overrides:
getReceiveBufferSizein classSocket- Throws:
SocketException
-
setKeepAlive
- Overrides:
setKeepAlivein classSocket- Throws:
SocketException
-
getKeepAlive
- Overrides:
getKeepAlivein classSocket- Throws:
SocketException
-
setTrafficClass
- Overrides:
setTrafficClassin classSocket- Throws:
SocketException
-
getTrafficClass
- Overrides:
getTrafficClassin classSocket- Throws:
SocketException
-
setReuseAddress
- Overrides:
setReuseAddressin classSocket- Throws:
SocketException
-
getReuseAddress
- Overrides:
getReuseAddressin classSocket- Throws:
SocketException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSocket- Throws:
IOException
-
shutdownInput
- Overrides:
shutdownInputin classSocket- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutputin classSocket- Throws:
IOException
-
toString
-
isConnected
public boolean isConnected()- Overrides:
isConnectedin classSocket
-
isBound
public boolean isBound() -
isClosed
public boolean isClosed() -
isInputShutdown
public boolean isInputShutdown()- Overrides:
isInputShutdownin classSocket
-
isOutputShutdown
public boolean isOutputShutdown()- Overrides:
isOutputShutdownin classSocket
-
setOption
- Overrides:
setOptionin classSocket- Throws:
IOException
-
getOption
- Overrides:
getOptionin classSocket- Throws:
IOException
-
supportedOptions
- Overrides:
supportedOptionsin classSocket
-
getFileDescriptor$
KLUDGE for Android, which has this illegal non-Java Compatible method.- Returns:
- the FileDescriptor object
-