0N/A/*
2362N/A * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.nio.channels;
0N/A
0N/Aimport java.io.IOException;
0N/Aimport java.io.Closeable;
0N/A
0N/A
0N/A/**
0N/A * A nexus for I/O operations.
0N/A *
0N/A * <p> A channel represents an open connection to an entity such as a hardware
0N/A * device, a file, a network socket, or a program component that is capable of
0N/A * performing one or more distinct I/O operations, for example reading or
0N/A * writing.
0N/A *
0N/A * <p> A channel is either open or closed. A channel is open upon creation,
0N/A * and once closed it remains closed. Once a channel is closed, any attempt to
0N/A * invoke an I/O operation upon it will cause a {@link ClosedChannelException}
0N/A * to be thrown. Whether or not a channel is open may be tested by invoking
0N/A * its {@link #isOpen isOpen} method.
0N/A *
0N/A * <p> Channels are, in general, intended to be safe for multithreaded access
0N/A * as described in the specifications of the interfaces and classes that extend
0N/A * and implement this interface.
0N/A *
0N/A *
0N/A * @author Mark Reinhold
0N/A * @author JSR-51 Expert Group
0N/A * @since 1.4
0N/A */
0N/A
0N/Apublic interface Channel extends Closeable {
0N/A
0N/A /**
0N/A * Tells whether or not this channel is open. </p>
0N/A *
0N/A * @return <tt>true</tt> if, and only if, this channel is open
0N/A */
0N/A public boolean isOpen();
0N/A
0N/A /**
0N/A * Closes this channel.
0N/A *
0N/A * <p> After a channel is closed, any further attempt to invoke I/O
0N/A * operations upon it will cause a {@link ClosedChannelException} to be
0N/A * thrown.
0N/A *
0N/A * <p> If this channel is already closed then invoking this method has no
0N/A * effect.
0N/A *
0N/A * <p> This method may be invoked at any time. If some other thread has
0N/A * already invoked it, however, then another invocation will block until
0N/A * the first invocation is complete, after which it will return without
0N/A * effect. </p>
0N/A *
0N/A * @throws IOException If an I/O error occurs
0N/A */
0N/A public void close() throws IOException;
0N/A
0N/A}