2736N/A/*
2736N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2736N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2736N/A *
2736N/A * This code is free software; you can redistribute it and/or modify it
2736N/A * under the terms of the GNU General Public License version 2 only, as
2736N/A * published by the Free Software Foundation. Oracle designates this
2736N/A * particular file as subject to the "Classpath" exception as provided
2736N/A * by Oracle in the LICENSE file that accompanied this code.
2736N/A *
2736N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2736N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2736N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2736N/A * version 2 for more details (a copy is included in the LICENSE file that
2736N/A * accompanied this code).
2736N/A *
2736N/A * You should have received a copy of the GNU General Public License version
2736N/A * 2 along with this work; if not, write to the Free Software Foundation,
2736N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2736N/A *
2736N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2736N/A * or visit www.oracle.com if you need additional information or have any
2736N/A * questions.
2736N/A */
2736N/A
2736N/Apackage sun.nio.ch;
2736N/A
2736N/Aimport java.nio.channels.SocketChannel;
2736N/Aimport java.nio.channels.ServerSocketChannel;
2736N/Aimport java.nio.channels.spi.SelectorProvider;
2736N/Aimport java.io.FileDescriptor;
2736N/Aimport java.io.IOException;
2736N/A
2736N/A/**
2736N/A * Provides access to implementation private constructors and methods.
2736N/A */
2736N/A
2736N/Apublic final class Secrets {
2736N/A private Secrets() { }
2736N/A
2736N/A private static SelectorProvider provider() {
2736N/A SelectorProvider p = SelectorProvider.provider();
2736N/A if (!(p instanceof SelectorProviderImpl))
2736N/A throw new UnsupportedOperationException();
2736N/A return p;
2736N/A }
2736N/A
2736N/A public static SocketChannel newSocketChannel(FileDescriptor fd) {
2736N/A try {
2736N/A return new SocketChannelImpl(provider(), fd, false);
2736N/A } catch (IOException ioe) {
2736N/A throw new AssertionError(ioe);
2736N/A }
2736N/A }
2736N/A
2736N/A public static ServerSocketChannel newServerSocketChannel(FileDescriptor fd) {
2736N/A try {
2736N/A return new ServerSocketChannelImpl(provider(), fd, false);
2736N/A } catch (IOException ioe) {
2736N/A throw new AssertionError(ioe);
2736N/A }
2736N/A }
2736N/A}