Package one.nio.net

Class JavaDatagramSocket

  • 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

    final class JavaDatagramSocket
    extends SelectableJavaSocket
    • Field Detail

      • ch

        final java.nio.channels.DatagramChannel ch
    • Constructor Detail

      • JavaDatagramSocket

        JavaDatagramSocket()
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • isOpen

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

        public final 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
      • connect

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

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

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

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

        public final 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 final void writeFully​(byte[] data,
                                     int offset,
                                     int count)
                              throws java.io.IOException
        Specified by:
        writeFully in class Socket
        Throws:
        java.io.IOException
      • send

        public final 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 final int readRaw​(long buf,
                                 int count,
                                 int flags)
                          throws java.io.IOException
        Specified by:
        readRaw in class Socket
        Throws:
        java.io.IOException
      • read

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

        public final java.net.InetSocketAddress recv​(java.nio.ByteBuffer dst,
                                                     int flags)
                                              throws java.io.IOException
        Specified by:
        recv in class Socket
        Throws:
        java.io.IOException
      • readFully

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public final 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 final void setRecvBuffer​(int recvBuf)
        Specified by:
        setRecvBuffer in class Socket
      • setTos

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

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

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

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

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

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

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