Package one.nio.net

Class JavaSslClientSocket

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel

    public final class JavaSslClientSocket
    extends Socket
    • Field Detail

      • socket

        private final javax.net.ssl.SSLSocket socket
      • outCh

        private volatile java.nio.channels.WritableByteChannel outCh
      • inCh

        private volatile java.nio.channels.ReadableByteChannel inCh
      • outputStream

        private volatile java.io.OutputStream outputStream
      • inputStream

        private volatile java.io.InputStream inputStream
    • Method Detail

      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
        Specified by:
        isOpen in class Socket
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class Socket
      • accept

        public Socket accept()
                      throws java.io.IOException
        Specified by:
        accept in class Socket
        Throws:
        java.io.IOException
      • connect

        public void connect​(java.net.InetAddress address,
                            int port)
                     throws java.io.IOException
        Specified by:
        connect in class Socket
        Throws:
        java.io.IOException
      • bind

        public void bind​(java.net.InetAddress address,
                         int port,
                         int backlog)
                  throws java.io.IOException
        Specified by:
        bind in class Socket
        Throws:
        java.io.IOException
      • writeRaw

        public int writeRaw​(long buf,
                            int count,
                            int flags)
                     throws java.io.IOException
        Specified by:
        writeRaw in class Socket
        Throws:
        java.io.IOException
      • write

        public int write​(byte[] data,
                         int offset,
                         int count,
                         int flags)
                  throws java.io.IOException
        Specified by:
        write in class Socket
        Throws:
        java.io.IOException
      • writeFully

        public void writeFully​(byte[] data,
                               int offset,
                               int count)
                        throws java.io.IOException
        Specified by:
        writeFully in class Socket
        Throws:
        java.io.IOException
      • send

        public int send​(java.nio.ByteBuffer src,
                        int flags,
                        java.net.InetAddress address,
                        int port)
                 throws java.io.IOException
        Specified by:
        send in class Socket
        Throws:
        java.io.IOException
      • readRaw

        public int readRaw​(long buf,
                           int count,
                           int flags)
                    throws java.io.IOException
        Specified by:
        readRaw in class Socket
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] data,
                        int offset,
                        int count,
                        int flags)
                 throws java.io.IOException
        Specified by:
        read in class Socket
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(byte[] data,
                              int offset,
                              int count)
                       throws java.io.IOException
        Specified by:
        readFully in class Socket
        Throws:
        java.io.IOException
      • sendFile

        public long sendFile​(java.io.RandomAccessFile file,
                             long offset,
                             long count)
                      throws java.io.IOException
        Specified by:
        sendFile in class Socket
        Throws:
        java.io.IOException
      • recv

        public java.net.InetSocketAddress recv​(java.nio.ByteBuffer dst,
                                               int flags)
        Specified by:
        recv in class Socket
      • sendMsg

        public int sendMsg​(Msg msg,
                           int flags)
        Specified by:
        sendMsg in class Socket
      • recvMsg

        public int recvMsg​(Msg msg,
                           int flags)
                    throws java.io.IOException
        Specified by:
        recvMsg in class Socket
        Throws:
        java.io.IOException
      • setBlocking

        public void setBlocking​(boolean blocking)
        Specified by:
        setBlocking in class Socket
      • isBlocking

        public boolean isBlocking()
        Specified by:
        isBlocking in class Socket
      • setTimeout

        public void setTimeout​(int timeout)
        Specified by:
        setTimeout in class Socket
      • getTimeout

        public int getTimeout()
        Specified by:
        getTimeout in class Socket
      • setKeepAlive

        public void setKeepAlive​(boolean keepAlive)
        Specified by:
        setKeepAlive in class Socket
      • getKeepAlive

        public boolean getKeepAlive()
        Specified by:
        getKeepAlive in class Socket
      • setNoDelay

        public void setNoDelay​(boolean noDelay)
        Specified by:
        setNoDelay in class Socket
      • getNoDelay

        public boolean getNoDelay()
        Specified by:
        getNoDelay in class Socket
      • setTcpFastOpen

        public void setTcpFastOpen​(boolean tcpFastOpen)
        Specified by:
        setTcpFastOpen in class Socket
      • setDeferAccept

        public void setDeferAccept​(boolean deferAccept)
        Specified by:
        setDeferAccept in class Socket
      • setReuseAddr

        public void setReuseAddr​(boolean reuseAddr,
                                 boolean reusePort)
        Specified by:
        setReuseAddr in class Socket
      • getReuseAddr

        public boolean getReuseAddr()
        Specified by:
        getReuseAddr in class Socket
      • getReusePort

        public boolean getReusePort()
        Specified by:
        getReusePort in class Socket
      • setRecvBuffer

        public void setRecvBuffer​(int recvBuf)
        Specified by:
        setRecvBuffer in class Socket
      • setSendBuffer

        public void setSendBuffer​(int sendBuf)
        Specified by:
        setSendBuffer in class Socket
      • setTos

        public void setTos​(int tos)
        Specified by:
        setTos in class Socket
      • getTos

        public int getTos()
        Specified by:
        getTos in class Socket
      • getOption

        public byte[] getOption​(int level,
                                int option)
        Specified by:
        getOption in class Socket
      • setOption

        public boolean setOption​(int level,
                                 int option,
                                 byte[] value)
        Specified by:
        setOption in class Socket
      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in class Socket
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Specified by:
        getRemoteAddress in class Socket
      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • listen

        public void listen​(int backlog)
                    throws java.io.IOException
        Specified by:
        listen in class Socket
        Throws:
        java.io.IOException