OSNetworkSystempublic 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 void | accept(java.io.FileDescriptor fdServer, java.net.SocketImpl newSocket, java.io.FileDescriptor fdnewSocket, int timeout)
acceptSocketImpl(fdServer, newSocket, fdnewSocket, timeout);
| static native void | acceptSocketImpl(java.io.FileDescriptor fdServer, java.net.SocketImpl newSocket, java.io.FileDescriptor fdnewSocket, int timeout)
| public int | availableStream(java.io.FileDescriptor aFD)
return availableStreamImpl(aFD);
| static native int | availableStreamImpl(java.io.FileDescriptor aFD)
| public void | bind(java.io.FileDescriptor aFD, int port, java.net.InetAddress inetAddress)
socketBindImpl(aFD, port, inetAddress);
| public boolean | bind2(java.io.FileDescriptor aFD, int port, boolean bindToDevice, java.net.InetAddress inetAddress)
return socketBindImpl2(aFD, port, bindToDevice, inetAddress);
| public int | connect(java.io.FileDescriptor aFD, int trafficClass, java.net.InetAddress inetAddress, int port)
return connectSocketImpl(aFD, trafficClass, inetAddress, port);
| public void | connectDatagram(java.io.FileDescriptor aFD, int port, int trafficClass, java.net.InetAddress inetAddress)
connectDatagramImpl2(aFD, port, trafficClass, inetAddress);
| static native void | connectDatagramImpl2(java.io.FileDescriptor aFD, int port, int trafficClass, java.net.InetAddress inetAddress)
| static native int | connectSocketImpl(java.io.FileDescriptor aFD, int trafficClass, java.net.InetAddress inetAddress, int port)
| public void | connectStreamWithTimeoutSocket(java.io.FileDescriptor aFD, int aport, int timeout, int trafficClass, java.net.InetAddress inetAddress)
connectStreamWithTimeoutSocketImpl(aFD, aport, timeout, trafficClass,
inetAddress);
| static native void | connectStreamWithTimeoutSocketImpl(java.io.FileDescriptor aFD, int aport, int timeout, int trafficClass, java.net.InetAddress inetAddress)
| public int | connectWithTimeout(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 int | connectWithTimeoutSocketImpl(java.io.FileDescriptor aFD, int timeout, int trafficClass, java.net.InetAddress hostname, int port, int step, byte[] context)
| public void | createDatagramSocket(java.io.FileDescriptor fd, boolean preferIPv4Stack)
createDatagramSocketImpl(fd, preferIPv4Stack);
| static native void | createDatagramSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)
| public void | createMulticastSocket(java.io.FileDescriptor aFD, boolean preferIPv4Stack)
createMulticastSocketImpl(aFD, preferIPv4Stack);
| static native void | createMulticastSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)
| public void | createServerStreamSocket(java.io.FileDescriptor aFD, boolean preferIPv4Stack)
createServerStreamSocketImpl(aFD, preferIPv4Stack);
| static native void | createServerStreamSocketImpl(java.io.FileDescriptor aFD, boolean preferIPv4Stack)
| public void | createSocket(java.io.FileDescriptor fd, boolean preferIPv4Stack)
createSocketImpl(fd, preferIPv4Stack);
| static native void | createSocketImpl(java.io.FileDescriptor fd, boolean preferIPv4Stack)
| public void | disconnectDatagram(java.io.FileDescriptor aFD)
disconnectDatagramImpl(aFD);
| static native void | disconnectDatagramImpl(java.io.FileDescriptor aFD)
| public java.net.InetAddress | getHostByAddr(byte[] addr)
return getHostByAddrImpl(addr);
| static native java.net.InetAddress | getHostByAddrImpl(byte[] addr)
| public java.net.InetAddress | getHostByName(java.lang.String addr, boolean preferIPv6Addresses)
return getHostByNameImpl(addr, preferIPv6Addresses);
| static native java.net.InetAddress | getHostByNameImpl(java.lang.String addr, boolean preferIPv6Addresses)
| public static org.apache.harmony.luni.platform.OSNetworkSystem | getOSNetworkSystem()
return ref;
| public int | getSocketFlags()
return getSocketFlagsImpl();
| static native int | getSocketFlagsImpl()
| public java.net.InetAddress | getSocketLocalAddress(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)
return getSocketLocalAddressImpl(aFD, preferIPv6Addresses);
| static native java.net.InetAddress | getSocketLocalAddressImpl(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)
| public int | getSocketLocalPort(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)
return getSocketLocalPortImpl(aFD, preferIPv6Addresses);
| static native int | getSocketLocalPortImpl(java.io.FileDescriptor aFD, boolean preferIPv6Addresses)
| public java.lang.Object | getSocketOption(java.io.FileDescriptor aFD, int opt)
return getSocketOptionImpl(aFD, opt);
| static native java.lang.Object | getSocketOptionImpl(java.io.FileDescriptor aFD, int opt)
| public java.nio.channels.Channel | inheritedChannel()
return inheritedChannelImpl();
| native java.nio.channels.Channel | inheritedChannelImpl()
| public void | listenStreamSocket(java.io.FileDescriptor aFD, int backlog)
listenStreamSocketImpl(aFD, backlog);
| static native void | listenStreamSocketImpl(java.io.FileDescriptor aFD, int backlog)
| public void | oneTimeInitialization(boolean jcl_supports_ipv6)
if (!isNetworkInited){
oneTimeInitializationImpl(jcl_supports_ipv6);
isNetworkInited = true;
}
| native void | oneTimeInitializationImpl(boolean jcl_supports_ipv6)
| public int | peekDatagram(java.io.FileDescriptor aFD, java.net.InetAddress sender, int receiveTimeout)
return peekDatagramImpl(aFD, sender, receiveTimeout);
| static native int | peekDatagramImpl(java.io.FileDescriptor aFD, java.net.InetAddress sender, int receiveTimeout)
| public int | read(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)
return readSocketImpl(aFD, data, offset, count, timeout);
| public int | readDirect(java.io.FileDescriptor aFD, int address, int offset, int count, int timeout)
return readSocketDirectImpl(aFD, address, offset, count, timeout);
| static native int | readSocketDirectImpl(java.io.FileDescriptor aFD, int address, int offset, int count, int timeout)
| static native int | readSocketImpl(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)
| public int | receiveDatagram(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 int | receiveDatagramDirect(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 int | receiveDatagramDirectImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)
| static native int | receiveDatagramImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, byte[] data, int offset, int length, int receiveTimeout, boolean peek)
| public int | receiveStream(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)
return receiveStreamImpl(aFD, data, offset, count, timeout);
| static native int | receiveStreamImpl(java.io.FileDescriptor aFD, byte[] data, int offset, int count, int timeout)
| public int | recvConnectedDatagram(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 int | recvConnectedDatagramDirect(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 int | recvConnectedDatagramDirectImpl(java.io.FileDescriptor aFD, java.net.DatagramPacket packet, int address, int offset, int length, int receiveTimeout, boolean peek)
| static native int | recvConnectedDatagramImpl(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 int | selectImpl(java.io.FileDescriptor[] readfd, java.io.FileDescriptor[] writefd, int cread, int cwirte, int[] flags, long timeout)
| public int | sendConnectedDatagram(java.io.FileDescriptor fd, byte[] data, int offset, int length, boolean bindToDevice)
return sendConnectedDatagramImpl(fd, data, offset, length, bindToDevice);
| public int | sendConnectedDatagramDirect(java.io.FileDescriptor fd, int address, int offset, int length, boolean bindToDevice)
return sendConnectedDatagramDirectImpl(fd, address, offset, length, bindToDevice);
| static native int | sendConnectedDatagramDirectImpl(java.io.FileDescriptor fd, int address, int offset, int length, boolean bindToDevice)
| static native int | sendConnectedDatagramImpl(java.io.FileDescriptor fd, byte[] data, int offset, int length, boolean bindToDevice)
| public int | sendDatagram(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 int | sendDatagram2(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 int | sendDatagramDirect(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 int | sendDatagramDirectImpl(java.io.FileDescriptor fd, int address, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)
| static native int | sendDatagramImpl(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, boolean bindToDevice, int trafficClass, java.net.InetAddress inetAddress)
| static native int | sendDatagramImpl2(java.io.FileDescriptor fd, byte[] data, int offset, int length, int port, java.net.InetAddress inetAddress)
| public int | sendStream(java.io.FileDescriptor fd, byte[] data, int offset, int count)
return sendStreamImpl(fd, data, offset, count);
| static native int | sendStreamImpl(java.io.FileDescriptor fd, byte[] data, int offset, int count)
| public void | sendUrgentData(java.io.FileDescriptor fd, byte value)
sendUrgentDataImpl(fd, value);
| static native void | sendUrgentDataImpl(java.io.FileDescriptor fd, byte value)
| public void | setInetAddress(java.net.InetAddress sender, byte[] address)
setInetAddressImpl(sender, address);
| native void | setInetAddressImpl(java.net.InetAddress sender, byte[] address)
| public void | setNonBlocking(java.io.FileDescriptor aFD, boolean block)
setNonBlockingImpl(aFD, block);
| static native void | setNonBlockingImpl(java.io.FileDescriptor aFD, boolean block)
| public void | setSocketOption(java.io.FileDescriptor aFD, int opt, java.lang.Object optVal)
setSocketOptionImpl(aFD, opt, optVal);
| static native void | setSocketOptionImpl(java.io.FileDescriptor aFD, int opt, java.lang.Object optVal)
| public void | shutdownInput(java.io.FileDescriptor descriptor)
shutdownInputImpl(descriptor);
| private native void | shutdownInputImpl(java.io.FileDescriptor descriptor)
| public void | shutdownOutput(java.io.FileDescriptor descriptor)
shutdownOutputImpl(descriptor);
| private native void | shutdownOutputImpl(java.io.FileDescriptor descriptor)
| static native void | socketBindImpl(java.io.FileDescriptor aFD, int port, java.net.InetAddress inetAddress)
| static native boolean | socketBindImpl2(java.io.FileDescriptor aFD, int port, boolean bindToDevice, java.net.InetAddress inetAddress)
| public void | socketClose(java.io.FileDescriptor aFD)
socketCloseImpl(aFD);
| static native void | socketCloseImpl(java.io.FileDescriptor aFD)
| public boolean | supportsUrgentData(java.io.FileDescriptor fd)
return supportsUrgentDataImpl(fd);
| static native boolean | supportsUrgentDataImpl(java.io.FileDescriptor fd)
| public int | write(java.io.FileDescriptor aFD, byte[] data, int offset, int count)
return writeSocketImpl(aFD, data, offset, count);
| public int | writeDirect(java.io.FileDescriptor aFD, int address, int offset, int count)
return writeSocketDirectImpl(aFD, address, offset, count);
| static native int | writeSocketDirectImpl(java.io.FileDescriptor fd, int address, int offset, int count)
| static native int | writeSocketImpl(java.io.FileDescriptor fd, byte[] data, int offset, int count)
|
|