Buffer.java, [...]: Fixed javadocs and jalopied all over java.nio.

2004-04-20  Michael Koch  <konqueror@gmx.de>

	* java/nio/Buffer.java,
	java/nio/channels/AlreadyConnectedException.java,
	java/nio/channels/AsynchronousCloseException.java,
	java/nio/channels/ByteChannel.java,
	java/nio/channels/CancelledKeyException.java,
	java/nio/channels/Channel.java,
	java/nio/channels/Channels.java,
	java/nio/channels/ClosedByInterruptException.java,
	java/nio/channels/ClosedChannelException.java,
	java/nio/channels/ClosedSelectorException.java,
	java/nio/channels/ConnectionPendingException.java,
	java/nio/channels/DatagramChannel.java,
	java/nio/channels/FileChannel.java,
	java/nio/channels/FileLock.java,
	java/nio/channels/FileLockInterruptionException.java,
	java/nio/channels/GatheringByteChannel.java,
	java/nio/channels/IllegalBlockingModeException.java,
	java/nio/channels/IllegalSelectorException.java,
	java/nio/channels/InterruptibleChannel.java,
	java/nio/channels/NoConnectionPendingException.java,
	java/nio/channels/NonReadableChannelException.java,
	java/nio/channels/NonWritableChannelException.java,
	java/nio/channels/NotYetBoundException.java,
	java/nio/channels/NotYetConnectedException.java,
	java/nio/channels/OverlappingFileLockException.java,
	java/nio/channels/Pipe.java,
	java/nio/channels/ReadableByteChannel.java,
	java/nio/channels/ScatteringByteChannel.java,
	java/nio/channels/SelectableChannel.java,
	java/nio/channels/SelectionKey.java,
	java/nio/channels/Selector.java,
	java/nio/channels/ServerSocketChannel.java,
	java/nio/channels/SocketChannel.java,
	java/nio/channels/UnresolvedAddressException.java,
	java/nio/channels/UnsupportedAddressTypeException.java,
	java/nio/channels/WritableByteChannel.java,
	java/nio/channels/spi/AbstractInterruptibleChannel.java,
	java/nio/channels/spi/AbstractSelectableChannel.java,
	java/nio/channels/spi/AbstractSelectionKey.java,
	java/nio/channels/spi/AbstractSelector.java,
	java/nio/channels/spi/SelectorProvider.java,
	java/nio/charset/spi/CharsetProvider.java:
	Fixed javadocs and jalopied all over java.nio.

From-SVN: r80909
This commit is contained in:
Michael Koch 2004-04-20 15:27:38 +00:00 committed by Michael Koch
parent 08c5d75719
commit 92e1fe6748
43 changed files with 655 additions and 457 deletions

View file

@ -43,9 +43,9 @@ import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
public abstract class AbstractSelectableChannel extends SelectableChannel
{
private boolean blocking = true;
@ -55,8 +55,10 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/**
* Initializes the channel
*
* @param provider the provider that created this channel
*/
protected AbstractSelectableChannel (SelectorProvider provider)
protected AbstractSelectableChannel(SelectorProvider provider)
{
this.provider = provider;
}
@ -64,27 +66,35 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/**
* Retrieves the object upon which the configureBlocking and register
* methods synchronize.
*
* @return the blocking lock
*/
public final Object blockingLock ()
public final Object blockingLock()
{
return LOCK;
}
/**
* Adjusts this channel's blocking mode.
*
* @param blocking true if blocking should be enabled, false otherwise
*
* @return this channel
*
* @exception IOException If an error occurs
*/
public final SelectableChannel configureBlocking (boolean blocking)
public final SelectableChannel configureBlocking(boolean blocking)
throws IOException
{
synchronized (blockingLock())
{
if (this.blocking != blocking)
{
implConfigureBlocking(blocking);
this.blocking = blocking;
}
if (this.blocking != blocking)
{
implConfigureBlocking(blocking);
this.blocking = blocking;
}
}
return this;
}
@ -93,25 +103,34 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
*
* @exception IOException If an error occurs
*/
protected final void implCloseChannel () throws IOException
protected final void implCloseChannel() throws IOException
{
implCloseSelectableChannel ();
implCloseSelectableChannel();
}
/**
* Closes this selectable channel.
*
* @exception IOException If an error occurs
*/
protected abstract void implCloseSelectableChannel () throws IOException;
protected abstract void implCloseSelectableChannel()
throws IOException;
/**
* Adjusts this channel's blocking mode.
*
* @param blocking true if blocking should be enabled, false otherwise
*
* @exception IOException If an error occurs
*/
protected abstract void implConfigureBlocking (boolean block)
protected abstract void implConfigureBlocking(boolean blocking)
throws IOException;
/**
* Tells whether or not every I/O operation on this channel will block
* until it completes.
*
* @return true of this channel is blocking, false otherwise
*/
public final boolean isBlocking()
{
@ -121,87 +140,104 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/**
* Tells whether or not this channel is currently registered with
* any selectors.
*
* @return true if this channel is registered, false otherwise
*/
public final boolean isRegistered()
{
return !keys.isEmpty();
return ! keys.isEmpty();
}
/**
* Retrieves the key representing the channel's registration with the
* given selector.
*
* @param selector the selector to get a selection key for
*
* @return the selection key this channel is registered with
*/
public final SelectionKey keyFor(Selector selector)
{
if (! isOpen())
return null;
try
{
synchronized(blockingLock())
synchronized (blockingLock())
{
return locate (selector);
return locate(selector);
}
}
catch (Exception e)
{
return null;
return null;
}
}
/**
* Returns the provider that created this channel.
*
* @return the selector provider that created this channel
*/
public final SelectorProvider provider ()
public final SelectorProvider provider()
{
return provider;
}
private SelectionKey locate (Selector selector)
private SelectionKey locate(Selector selector)
{
ListIterator it = keys.listIterator ();
while (it.hasNext ())
ListIterator it = keys.listIterator();
while (it.hasNext())
{
SelectionKey key = (SelectionKey) it.next();
if (key.selector() == selector)
return key;
SelectionKey key = (SelectionKey) it.next();
if (key.selector() == selector)
return key;
}
return null;
}
/**
* Registers this channel with the given selector, returning a selection key.
*
* @param selin the seletor to use
* @param ops the interested operations
* @param att an attachment for the returned selection key
*
* @return the registered selection key
*
* @exception ClosedChannelException If the channel is already closed.
*/
public final SelectionKey register (Selector selin, int ops, Object att)
public final SelectionKey register(Selector selin, int ops, Object att)
throws ClosedChannelException
{
if (!isOpen ())
if (! isOpen())
throw new ClosedChannelException();
if ((ops & ~validOps()) != 0)
throw new IllegalArgumentException();
SelectionKey key = null;
AbstractSelector selector = (AbstractSelector) selin;
synchronized (blockingLock())
{
key = locate (selector);
key = locate(selector);
if (key != null)
{
if (key != null)
{
if (att != null)
key.attach (att);
}
else
{
key = selector.register (this, ops, att);
if (key != null)
addSelectionKey (key);
}
key.attach(att);
}
else
{
key = selector.register(this, ops, att);
if (key != null)
addSelectionKey(key);
}
}
return key;