本文整理汇总了Java中sun.net.sdp.SdpSupport类的典型用法代码示例。如果您正苦于以下问题:Java SdpSupport类的具体用法?Java SdpSupport怎么用?Java SdpSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SdpSupport类属于sun.net.sdp包,在下文中一共展示了SdpSupport类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertTcpToSdpIfMatch
import sun.net.sdp.SdpSupport; //导入依赖的package包/类
private void convertTcpToSdpIfMatch(FileDescriptor fdObj,
Action action,
InetAddress address,
int port)
throws IOException
{
boolean matched = false;
for (Rule rule: rules) {
if (rule.match(action, address, port)) {
SdpSupport.convertSocket(fdObj);
matched = true;
break;
}
}
if (log != null) {
String addr = (address instanceof Inet4Address) ?
address.getHostAddress() : "[" + address.getHostAddress() + "]";
if (matched) {
log.format("%s to %s:%d (socket converted to SDP protocol)\n", action, addr, port);
} else {
log.format("%s to %s:%d (no match)\n", action, addr, port);
}
}
}
示例2: create
import sun.net.sdp.SdpSupport; //导入依赖的package包/类
@Override
protected void create(boolean stream) throws IOException {
if (!stream)
throw new UnsupportedOperationException("Must be a stream socket");
fd = SdpSupport.createSocket();
if (socket != null)
socket.setCreated();
if (serverSocket != null)
serverSocket.setCreated();
}
示例3: openServerSocketChannel
import sun.net.sdp.SdpSupport; //导入依赖的package包/类
/**
* Opens a socket channel to a SDP socket.
*
* <p> The channel will be associated with the system-wide default
* {@link java.nio.channels.spi.SelectorProvider SelectorProvider}.
*
* @return a new ServerSocketChannel
*
* @throws UnsupportedOperationException
* If SDP is not supported or not supported by the default selector
* provider
* @throws IOException
* If an I/O error occurs
*/
public static ServerSocketChannel openServerSocketChannel()
throws IOException
{
FileDescriptor fd = SdpSupport.createSocket();
return sun.nio.ch.Secrets.newServerSocketChannel(fd);
}
示例4: openSocketChannel
import sun.net.sdp.SdpSupport; //导入依赖的package包/类
/**
* Opens a socket channel to a SDP socket.
*
* <p> The channel will be associated with the system-wide default
* {@link java.nio.channels.spi.SelectorProvider SelectorProvider}.
*
* @return a new SocketChannel
*
* @throws UnsupportedOperationException
* If SDP is not supported or not supported by the default selector
* provider
* @throws IOException
* If an I/O error occurs.
*/
public static SocketChannel openSocketChannel() throws IOException {
FileDescriptor fd = SdpSupport.createSocket();
return sun.nio.ch.Secrets.newSocketChannel(fd);
}