当前位置: 首页>>代码示例>>Java>>正文


Java AlreadyBoundException类代码示例

本文整理汇总了Java中java.nio.channels.AlreadyBoundException的典型用法代码示例。如果您正苦于以下问题:Java AlreadyBoundException类的具体用法?Java AlreadyBoundException怎么用?Java AlreadyBoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AlreadyBoundException类属于java.nio.channels包,在下文中一共展示了AlreadyBoundException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import java.nio.channels.AlreadyBoundException; //导入依赖的package包/类
/** @hide Until ready for a public API change */
@Override
synchronized public DatagramChannel bind(SocketAddress local) throws IOException {
    checkOpen();
    if (isBound) {
        throw new AlreadyBoundException();
    }

    if (local == null) {
        local = new InetSocketAddress(Inet4Address.ANY, 0);
    } else if (!(local instanceof InetSocketAddress)) {
        throw new UnsupportedAddressTypeException();
    }

    InetSocketAddress localAddress = (InetSocketAddress) local;
    IoBridge.bind(fd, localAddress.getAddress(), localAddress.getPort());
    onBind(true /* updateSocketState */);
    return this;
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:20,代码来源:DatagramChannelImpl.java

示例2: bind

import java.nio.channels.AlreadyBoundException; //导入依赖的package包/类
/** @hide Until ready for a public API change */
@Override
synchronized public final SocketChannel bind(SocketAddress local) throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (isBound) {
        throw new AlreadyBoundException();
    }

    if (local == null) {
        local = new InetSocketAddress(Inet4Address.ANY, 0);
    } else if (!(local instanceof InetSocketAddress)) {
        throw new UnsupportedAddressTypeException();
    }

    InetSocketAddress localAddress = (InetSocketAddress) local;
    IoBridge.bind(fd, localAddress.getAddress(), localAddress.getPort());
    onBind(true /* updateSocketState */);
    return this;
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:22,代码来源:SocketChannelImpl.java

示例3: bind

import java.nio.channels.AlreadyBoundException; //导入依赖的package包/类
/** @hide Until ready for a public API change */
@Override
public final ServerSocketChannel bind(SocketAddress localAddr, int backlog) throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (socket.isBound()) {
        throw new AlreadyBoundException();
    }
    if (localAddr != null && !(localAddr instanceof InetSocketAddress)) {
        throw new UnsupportedAddressTypeException();
    }

    socket.bind(localAddr, backlog);
    return this;
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:17,代码来源:ServerSocketChannelImpl.java

示例4: throwAlreadyBoundException

import java.nio.channels.AlreadyBoundException; //导入依赖的package包/类
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:SctpNet.java


注:本文中的java.nio.channels.AlreadyBoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。