FileDocCategorySizeDatePackage
OSNetworkSystem.javaAPI DocAndroid 1.5 API29165Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.platform

OSNetworkSystem

public final class OSNetworkSystem extends Object implements INetworkSystem

Fields Summary
private static final int
ERRORCODE_SOCKET_TIMEOUT
private static OSNetworkSystem
ref
private static final int
INETADDR_REACHABLE
private static boolean
isNetworkInited
Constructors Summary
private OSNetworkSystem()

    

    // ----------------------------------------------------
    // Class Constructor
    // ----------------------------------------------------

    // can not be instantiated.
      
        super();
    
Methods Summary
public voidaccept(java.io.FileDescriptor fdServer, java.net.SocketImpl newSocket, java.io.FileDescriptor fdnewSocket, int timeout)

        acceptSocketImpl(fdServer, newSocket, fdnewSocket, timeout);
    
static native voidacceptSocketImpl(java.io.FileDescriptor fdServer, java.net.SocketImpl newSocket, java.io.FileDescriptor fdnewSocket, int timeout)

public intavailableStream(java.io.FileDescriptor aFD)

        return availableStreamImpl(aFD);
    
static native intavailableStreamImpl(java.io.FileDescriptor aFD)

public voidbind(java.io.FileDescriptor aFD, int port, java.net.InetAddress inetAddress)

        socketBindImpl(aFD, port, inetAddress);
    
public booleanbind2(java.io.FileDescriptor aFD, int port, boolean bindToDevice, java.net.InetAddress inetAddress)

        return socketBindImpl2(aFD, port, bindToDevice, inetAddress);
    
public intconnect(java.io.FileDescriptor aFD, int trafficClass, java.net.InetAddress inetAddress, int port)

        return connectSocketImpl(aFD, trafficClass, inetAddress, port);
    
public voidconnectDatagram(java.io.FileDescriptor aFD, int port, int trafficClass, java.net.InetAddress inetAddress)

        connectDatagramImpl2(aFD, port, trafficClass, inetAddress);
    
static native voidconnectDatagramImpl2(java.io.FileDescriptor aFD, int port, int trafficClass, java.net.InetAddress inetAddress)

static native intconnectSocketImpl(java.io.FileDescriptor aFD, int trafficClass, java.net.InetAddress inetAddress, int port)

public voidconnectStreamWithTimeoutSocket(java.io.FileDescriptor aFD, int aport, int timeout, int trafficClass, java.net.InetAddress inetAddress)

        connectStreamWithTimeoutSocketImpl(aFD, aport, timeout, trafficClass,
                inetAddress);
    
static native voidconnectStreamWithTimeoutSocketImpl(java.io.FileDescriptor aFD, int aport, int timeout, int trafficClass, java.net.InetAddress inetAddress)

public intconnectWithTimeout(java.io.FileDescriptor aFD, int timeout, int trafficClass, java.net.InetAddress inetAddress, int port, int step, byte[] context)

        return connectWithTimeoutSocketImpl(aFD, timeout, trafficClass,
                inetAddress, port, step, context);
    
static native intconnectWithTimeoutSocketImpl(java.io.FileDescriptor aFD, int timeout, int trafficClass, java.net.InetAddress hostname, int port, int step, byte[] context)

public voidcreateDatagramSocket(java.io.FileDescriptor fd, boolean preferIPv4Stack)

        createDatagramSocketImpl(fd, preferIPv4Stack);
    
static native voidcreateDatagramSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)

public voidcreateMulticastSocket(java.io.FileDescriptor aFD, boolean preferIPv4Stack)

        createMulticastSocketImpl(aFD, preferIPv4Stack);
    
static native voidcreateMulticastSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)

public voidcreateServerStreamSocket(java.io.FileDescriptor aFD, boolean preferIPv4Stack)

        createServerStreamSocketImpl(aFD, preferIPv4Stack);
    
static native voidcreateServerStreamSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)

public voidcreateSocket(java.io.FileDescriptor fd, boolean preferIPv4Stack)

        createSocketImpl(fd, preferIPv4Stack);
    
static native voidcreateSocketImpl(java.io.FileDescriptor fd, boolean preferIPv4Stack)

public voiddisconnectDatagram(java.io.FileDescriptor aFD)

        disconnectDatagramImpl(aFD);
    
static native voiddisconnectDatagramImpl(java.io.FileDescriptor aFD)

public java.net.InetAddressgetHostByAddr(byte[] addr)

        return getHostByAddrImpl(addr);
    
static native java.net.InetAddressgetHostByAddrImpl(byte[] addr)

public java.net.InetAddressgetHostByName(java.lang.String addr, boolean preferIPv6Addresses)

        return getHostByNameImpl(addr, preferIPv6Addresses);
    
static native java.net.InetAddressgetHostByNameImpl(java.lang.String addr, boolean preferIPv6Addresses)

public static org.apache.harmony.luni.platform.OSNetworkSystemgetOSNetworkSystem()

        return ref;
    
public intgetSocketFlags()

        return getSocketFlagsImpl();
    
static native intgetSocketFlagsImpl()

public java.net.InetAddressgetSocketLocalAddress(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)

        return getSocketLocalAddressImpl(aFD, preferIPv6Addresses);
    
static native java.net.InetAddressgetSocketLocalAddressImpl(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)

public intgetSocketLocalPort(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)

        return getSocketLocalPortImpl(aFD, preferIPv6Addresses);
    
static native intgetSocketLocalPortImpl(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)

public java.lang.ObjectgetSocketOption(java.io.FileDescriptor aFD, int opt)

        return getSocketOptionImpl(aFD, opt);
    
static native java.lang.ObjectgetSocketOptionImpl(java.io.FileDescriptor aFD, int opt)

public java.nio.channels.ChannelinheritedChannel()

        return inheritedChannelImpl();
    
native java.nio.channels.ChannelinheritedChannelImpl()

public voidlistenStreamSocket(java.io.FileDescriptor aFD, int backlog)

        listenStreamSocketImpl(aFD, backlog);
    
static native voidlistenStreamSocketImpl(java.io.FileDescriptor aFD, int backlog)

public voidoneTimeInitialization(boolean jcl_supports_ipv6)

        if (!isNetworkInited){
            oneTimeInitializationImpl(jcl_supports_ipv6);
            isNetworkInited = true;
        } 
    
native voidoneTimeInitializationImpl(boolean jcl_supports_ipv6)

public intpeekDatagram(java.io.FileDescriptor aFD, java.net.InetAddress sender, int receiveTimeout)

        return peekDatagramImpl(aFD, sender, receiveTimeout);
    
static native intpeekDatagramImpl(java.io.FileDescriptor aFD, java.net.InetAddress sender, int receiveTimeout)

public intread(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)

        return readSocketImpl(aFD, data, offset, count, timeout);
    
public intreadDirect(java.io.FileDescriptor aFD, int address, int offset, int count, int timeout)

        return readSocketDirectImpl(aFD, address, offset, count, timeout);
    
static native intreadSocketDirectImpl(java.io.FileDescriptor aFD, int address, int offset, int count, int timeout)

static native intreadSocketImpl(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)

public intreceiveDatagram(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, byte[] data, int offset, int length, int receiveTimeout, boolean peek)

        return receiveDatagramImpl(aFD, packet, data, offset, length,
                receiveTimeout, peek);
    
public intreceiveDatagramDirect(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)

        return receiveDatagramDirectImpl(aFD, packet, address, offset, length,
                receiveTimeout, peek);
    
static native intreceiveDatagramDirectImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)

static native intreceiveDatagramImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, byte[] data, int offset, int length, int receiveTimeout, boolean peek)

public intreceiveStream(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)

        return receiveStreamImpl(aFD, data, offset, count, timeout);
    
static native intreceiveStreamImpl(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)

public intrecvConnectedDatagram(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, byte[] data, int offset, int length, int receiveTimeout, boolean peek)

        return recvConnectedDatagramImpl(aFD, packet, data, offset, length,
                receiveTimeout, peek);
    
public intrecvConnectedDatagramDirect(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)

        return recvConnectedDatagramDirectImpl(aFD, packet, address, offset, length, receiveTimeout, peek);
    
static native intrecvConnectedDatagramDirectImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)

static native intrecvConnectedDatagramImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, byte[] data, int offset, int length, int receiveTimeout, boolean peek)

public int[]select(java.io.FileDescriptor[] readFDs, java.io.FileDescriptor[] writeFDs, long timeout)

        int countRead = readFDs.length;
        int countWrite = writeFDs.length;
        int result = 0;
        if (0 == countRead + countWrite) {
            return (new int[0]);
        }
        int[] flags = new int[countRead + countWrite];

        // handle timeout in native
        result = selectImpl(readFDs, writeFDs, countRead, countWrite, flags,
                timeout);

        if (0 <= result) {
            return flags;
        }
        if (ERRORCODE_SOCKET_TIMEOUT == result) {
            return new int[0];
        }
        throw new SocketException();

    
static native intselectImpl(java.io.FileDescriptor[] readfd, java.io.FileDescriptor[] writefd, int cread, int cwirte, int[] flags, long timeout)

public intsendConnectedDatagram(java.io.FileDescriptor fd, byte[] data, int offset, int length, boolean bindToDevice)

        return sendConnectedDatagramImpl(fd, data, offset, length, bindToDevice);
    
public intsendConnectedDatagramDirect(java.io.FileDescriptor fd, int address, int offset, int length, boolean bindToDevice)

        return sendConnectedDatagramDirectImpl(fd, address, offset, length, bindToDevice);
    
static native intsendConnectedDatagramDirectImpl(java.io.FileDescriptor fd, int address, int offset, int length, boolean bindToDevice)

static native intsendConnectedDatagramImpl(java.io.FileDescriptor fd, byte[] data, int offset, int length, boolean bindToDevice)

public intsendDatagram(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)

        return sendDatagramImpl(fd, data, offset, length, port, bindToDevice,
                trafficClass, inetAddress);
    
public intsendDatagram2(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, java.net.InetAddress inetAddress)

        return sendDatagramImpl2(fd, data, offset, length, port, inetAddress);
    
public intsendDatagramDirect(java.io.FileDescriptor fd, int address, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)

        return sendDatagramDirectImpl(fd, address, offset, length, port, bindToDevice,
                trafficClass, inetAddress);
    
static native intsendDatagramDirectImpl(java.io.FileDescriptor fd, int address, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)

static native intsendDatagramImpl(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)

static native intsendDatagramImpl2(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, java.net.InetAddress inetAddress)

public intsendStream(java.io.FileDescriptor fd, byte[] data, int offset, int count)

        return sendStreamImpl(fd, data, offset, count);
    
static native intsendStreamImpl(java.io.FileDescriptor fd, byte[] data, int offset, int count)

public voidsendUrgentData(java.io.FileDescriptor fd, byte value)

        sendUrgentDataImpl(fd, value);
    
static native voidsendUrgentDataImpl(java.io.FileDescriptor fd, byte value)

public voidsetInetAddress(java.net.InetAddress sender, byte[] address)

        setInetAddressImpl(sender, address);
    
native voidsetInetAddressImpl(java.net.InetAddress sender, byte[] address)

public voidsetNonBlocking(java.io.FileDescriptor aFD, boolean block)

        setNonBlockingImpl(aFD, block);
    
static native voidsetNonBlockingImpl(java.io.FileDescriptor aFD, boolean block)

public voidsetSocketOption(java.io.FileDescriptor aFD, int opt, java.lang.Object optVal)

        setSocketOptionImpl(aFD, opt, optVal);
    
static native voidsetSocketOptionImpl(java.io.FileDescriptor aFD, int opt, java.lang.Object optVal)

public voidshutdownInput(java.io.FileDescriptor descriptor)

        shutdownInputImpl(descriptor);
    
private native voidshutdownInputImpl(java.io.FileDescriptor descriptor)

public voidshutdownOutput(java.io.FileDescriptor descriptor)

        shutdownOutputImpl(descriptor);
    
private native voidshutdownOutputImpl(java.io.FileDescriptor descriptor)

static native voidsocketBindImpl(java.io.FileDescriptor aFD, int port, java.net.InetAddress inetAddress)

static native booleansocketBindImpl2(java.io.FileDescriptor aFD, int port, boolean bindToDevice, java.net.InetAddress inetAddress)

public voidsocketClose(java.io.FileDescriptor aFD)

        socketCloseImpl(aFD);
    
static native voidsocketCloseImpl(java.io.FileDescriptor aFD)

public booleansupportsUrgentData(java.io.FileDescriptor fd)

        return supportsUrgentDataImpl(fd);
    
static native booleansupportsUrgentDataImpl(java.io.FileDescriptor fd)

public intwrite(java.io.FileDescriptor aFD, byte[] data, int offset, int count)

        return writeSocketImpl(aFD, data, offset, count);
    
public intwriteDirect(java.io.FileDescriptor aFD, int address, int offset, int count)

        return writeSocketDirectImpl(aFD, address, offset, count);
    
static native intwriteSocketDirectImpl(java.io.FileDescriptor fd, int address, int offset, int count)

static native intwriteSocketImpl(java.io.FileDescriptor fd, byte[] data, int offset, int count)