You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by mh...@apache.org on 2007/01/22 18:12:36 UTC

svn commit: r498707 - in /mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio: AioCallbackException.java AioCompletionHandler.java AioException.java AioFuture.java AsynchronousFileChannel.java ByteBufferPosition.java Flags.java

Author: mheath
Date: Mon Jan 22 09:12:35 2007
New Revision: 498707

URL: http://svn.apache.org/viewvc?view=rev&rev=498707
Log:
Updated Java Docs

Modified:
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCompletionHandler.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java Mon Jan 22 09:12:35 2007
@@ -22,38 +22,44 @@
 import java.util.concurrent.ExecutionException;
 
 /**
- * 
+ * The exception that is thrown when an error occurs during a schedule AIO operatoin.  This exception is thrown when
+ * the {@link AioFuture#get()} method is invoked.
  * 
  * @author mheath
  */
 public class AioCallbackException extends ExecutionException {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
+    private final AioFuture future;
+
+    public AioCallbackException(AioFuture future) {
+        super();
+        this.future = future;
+    }
+
+    public AioCallbackException(AioFuture future, String message, Throwable cause) {
+        super(message, cause);
+        this.future = future;
+    }
+
+    public AioCallbackException(AioFuture future, String message) {
+        super(message);
+        this.future = future;
+    }
+
+    public AioCallbackException(AioFuture future, Throwable cause) {
+        super(cause);
+        this.future = future;
+    }
+
+    /**
+     * Returns the future where the exception occured.
+     * 
+     * @return  The future where the exception occured.
+     */
+    public AioFuture getAioFuture() {
+        return future;
+    }
 
-	private final AioFuture future;
-	
-	public AioCallbackException(AioFuture future) {
-		super();
-		this.future = future;
-	}
-
-	public AioCallbackException(AioFuture future, String message, Throwable cause) {
-		super(message, cause);
-		this.future = future;
-	}
-
-	public AioCallbackException(AioFuture future, String message) {
-		super(message);
-		this.future = future;
-	}
-
-	public AioCallbackException(AioFuture future, Throwable cause) {
-		super(cause);
-		this.future = future;
-	}
-
-	public AioFuture getAioFuture() {
-		return future;
-	}
-	
 }

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCompletionHandler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCompletionHandler.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCompletionHandler.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCompletionHandler.java Mon Jan 22 09:12:35 2007
@@ -19,8 +19,26 @@
  */
 package org.apache.aio;
 
+/**
+ * The handler for processing the results of an asynchronous operation.
+ * 
+ * <p>Each instance of {@link AioFuture} may have multiple AioCompletionHandler's registered with it that are invoked
+ * when the operation represented by the AioFuture are invoked.
+ * 
+ * @author mheath
+ *
+ * @param <T> The type of future object to be processed.
+ */
 public interface AioCompletionHandler<T extends AioFuture> {
 
-	void onCompletion(T future) throws AioCallbackException;
+    /**
+     * The method invoked when the operation completes.
+     * 
+     * <p>This method should complete in a timely manner to allow the thread to complete each completion handler in a
+     * timely fashion.
+     * 
+     * @param future  The future object representing the file channel operation.
+     */
+    void onCompletion(T future);
 	
 }

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java Mon Jan 22 09:12:35 2007
@@ -19,6 +19,11 @@
  */
 package org.apache.aio;
 
+/**
+ * Exception that is thrown when there is an error scheduling an asynchronous channel operation.
+ * 
+ * @author mheath
+ */
 public class AioException extends RuntimeException {
 
 	private static final long serialVersionUID = 1L;

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java Mon Jan 22 09:12:35 2007
@@ -23,6 +23,21 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
+/**
+ * Represents the result of an operation on an {@link AsynchronousFileChannel} operation.
+ * 
+ * <p>One or more {@link AioCompletionHandler completion handlers} may be associated with the future object.  Each
+ * completion handler is invoked when the operation represented by the future has completed.
+ * 
+ * <p>A single arbitrary object may be associated with the future.  The object is associated with the future using the
+ * {@link #setAttachment(Object)} method and retrieved using the {@link #getAttachment()} method.
+ * 
+ * @author mheath
+ *
+ * @param <V>  The type of value returned by the {@link #get()} method
+ * @param <F>  The type of <tt>AioFuture</tt> passed into the {@link AioCompletionHandler}'s associated with this
+ *             future
+ */
 public interface AioFuture<V, F extends AioFuture> extends Future<V> {
     
     static interface BatchFuture extends AioFuture<Long, BatchFuture> {
@@ -39,15 +54,52 @@
     
     static interface TruncateFuture extends AioFuture<Void, TruncateFuture> {}
     
+    /**
+     * Associates a {@link AioCompletionHandler} with this future.  The completion handler will be invoked when
+     * the operation represnted by this future completes.
+     * 
+     * @param completionHandler  The completion handler to be invoked.
+     */
     void addCompletionHandler(AioCompletionHandler<F> completionHandler);
 
-    void removeCompletionHandler(AioCompletionHandler<F> completionHandler);
-
+    /**
+     * Removes a {@link AioCompletionHandler} from this future.
+     * 
+     * @param completionHandler  The completion handler to be disassociated with this future
+     * @return  Returns true if the completion handler was disassociated with this future, false otherwise.
+     */
+    boolean removeCompletionHandler(AioCompletionHandler<F> completionHandler);
+
+    /**
+     * Returns the {@link AsynchronousFileChannel} where the operation represnted by this future orginated.
+     * 
+     * @return the <tt>AsynchronousFileChannel</tt> where the operation represnted by this future orginated
+     */
     AsynchronousFileChannel getChannel();
 
+    /**
+     * Returns the arbitrary object associated with this future.
+     * 
+     * @return the arbitrary object associated with this future, null if no object has been associated with this future
+     */
     Object getAttachment();
 
+    /**
+     * Associates an arbitrary object with this future.  Null may be used to remove an associated object from this
+     * future.
+     * 
+     * @param attachment an arbitrary object to be associated with this future
+     */
     void setAttachment(Object attachment);
 
+    /**
+     * Returns the result of the operation represented by this future.
+     * 
+     * @return  the result of the operation represented by this future
+     * @throws InterruptedException  Thrown if the current thread is interrupted while waiting for the get to return
+     * @throws AioCallbackException  Thrown if there was an error processing the operation represnted by this future.
+     * 
+     * TODO Determine if get returns before or after the callback methods are invoked
+     */
     V get() throws InterruptedException, ExecutionException, AioCallbackException;
 }

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java Mon Jan 22 09:12:35 2007
@@ -20,6 +20,7 @@
 package org.apache.aio;
 
 import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousCloseException;
 import java.nio.channels.Channel;
 import java.nio.channels.FileLock;
 import java.util.concurrent.ExecutionException;
@@ -59,6 +60,7 @@
      * Indicates if the file was opened for reading.
      *  
      * @return True if the file was opened for reading, false otherwise.
+     * @throws AioException  Thrown if there's an error determining if the file is readable
      */
     public abstract boolean isReadable() throws AioException;
 
@@ -66,6 +68,7 @@
      * Indicates if the file was opened for writing.
      * 
      * @return  True if the file was opened for writing, false otherwise.
+     * @throws  Thrown if there's an error determing if the file is writeable
      */
     public abstract boolean isWriteable() throws AioException;
 
@@ -73,6 +76,7 @@
      * Return's the current size of the channel's file.
      * 
      * @return  The current size of the channel's file mesuared in bytes.
+     * @throws AioException  Thrown if there's an error determining the size of the file
      */
     public abstract long size() throws AioException;
 
@@ -87,27 +91,194 @@
      * </pre>
      * 
      * @return A <tt>AioLockFuture</tt> object representing the pending result.
+     * 
+     * @see #lock(long,long,boolean)
+     * @see #tryLock()
+     * @see #tryLock(long,long,boolean)
      */
     public LockFuture lock() {
         return lock(0L, Long.MAX_VALUE, false);
     }
 
-    public abstract LockFuture lock(long position, long size, boolean shared);
+    /**
+     * Acquires a lock on the given region of this channel's file.
+     * 
+     * <p>The future object returned will coplete when the region can be locked or this channel is closed, whichever
+     * comes first.
+     * 
+     * <p>If this channel is closed while waiting for the lock, an {@link AioCallbackException} that wraps a
+     * {@link AsynchronousCloseException} will be thrown if the futures get method is invoked.
+     * 
+     * <p> The region specified by the <tt>position</tt> and <tt>size</tt> parameters need not be contained within, or
+     * even overlap, the actual underlying file.  Lock regions are fixed in size; if a locked region initially contains
+     * the end of the file and the file grows beyond the region then the new portion of the file will not be covered by
+     * the lock. If a file is expected to grow in size and a lock on the entire file is required then a region starting
+     * at zero, and no smaller than the expected maximum size of the file, should be locked.  The zero-argument {@link
+     * #lock()} method simply locks a region of size {@link Long#MAX_VALUE}.
+     * 
+     * <p> Some operating systems do not support shared locks, in which case a request for a shared lock is
+     * automatically converted into a request for an exclusive lock.  Whether the newly-acquired lock is shared or
+     * exclusive may be tested by invoking the resulting lock object's {@link FileLock#isShared() isShared} method.
+     *
+     * <p> File locks are held on behalf of the entire Java virtual machine.  They are not suitable for controlling
+     * access to a file by multiple threads within the same virtual machine.
+     * 
+     * @param position  The position at which the locked region is to start; must be non-negative.
+     * @param size  The size of the locked region; must be non-negative, and the sum of <tt>position</tt> and
+     *                  <tt>size</tt> must be non-negative.
+     * @param shared <tt>true</tt> to request a shared lock, in which case this channel must be open for reading (and
+     *                  possibly writing); <tt>false</tt> to request an exclusive lock, in which case this channel must
+     *                  be open for writing (and possibly reading)
+     * @return A future object that will return a {@link FileLock} when the future's get method is invoked.
+     * 
+     * @throws AioException  Thrown if there's an error while trying to initiate the future object for acquiring the
+     *                          lock.
+     *                          
+     * @see     #lock()
+     * @see     #tryLock()
+     * @see     #tryLock(long,long,boolean)
+     */
+    public abstract LockFuture lock(long position, long size, boolean shared) throws AioException;
 
-    public abstract FileLock tryLock();
+    /**
+     * Attempts to acquire an exclusive lock on this channel's file.
+     *
+     * <p>An invocation of this method of the form <tt>fc.tryLock()</tt> behaves in exactly the same way as the
+     * invocation
+     *
+     * <pre>
+     *     fc.{@link #tryLock(long,long,boolean) tryLock}(0L, Long.MAX_VALUE, false)
+     * </pre>
+     * 
+     * @return A lock object representing the newly-acquired lock, or <tt>null</tt> if the lock could not be acquired
+     *          because another program holds an overlapping lock
+     * @throws AioException  Exception thrown if the lock could not be acquired
+     * 
+     * @see     #lock()
+     * @see     #lock(long,long,boolean)
+     * @see     #tryLock(long,long,boolean)
+     */
+    public abstract FileLock tryLock() throws AioException;
 
-    public abstract FileLock tryLock(long position, long size, boolean shared);
+    /**
+     * Attempts to acquire a lock on the given region of this channel's file.
+     * 
+     * <p>This method does not return a future object and does not block.  An invocation of this method always returns
+     * immediately, either having acquired a lock on the requested region or having failed to do so.  If it fails to
+     * acquire a lock because an overlapping lock is held by another program then it returns <tt>null</tt>.  If it
+     * fails to acquire a lock for any other reason then an appropriate exception is thrown.
+     * 
+     * <p> Some operating systems do not support shared locks, in which case a request for a shared lock is
+     * automatically converted into a request for an exclusive lock.  Whether the newly-acquired lock is shared or
+     * exclusive may be tested by invoking the resulting lock object's {@link FileLock#isShared() isShared} method.
+     * 
+     * <p> File locks are held on behalf of the entire Java virtual machine.  They are not suitable for controlling
+     * access to a file by multiple threads within the same virtual machine.
+     * 
+     * @param position The position at which the locked region is to start; must be non-negative
+     * @param size  The size of the locked region; must be non-negative, and the sum of <tt>position</tt> and
+     *                  <tt>size</tt> must be non-negative.
+     * @param shared <tt>true</tt> to request a shared lock, in which case this channel must be open for reading (and
+     *                  possibly writing); <tt>false</tt> to request an exclusive lock, in which case this channel must
+     *                  be open for writing (and possibly reading)
+     * @return A lock object representing the newly-acquired lock, or <tt>null</tt> if the lock could not be acquired
+     *          because another program holds an overlapping lock
+     * @throws AioException  Exception thrown if the lock could not be acquired
+     * 
+     * @see     #lock()
+     * @see     #lock(long,long,boolean)
+     * @see     #tryLock()
+     */
+    public abstract FileLock tryLock(long position, long size, boolean shared) throws AioException;
 
-    public abstract SyncFuture sync();
+    /**
+     * Forces any updates to this channel's file to be written to the storage device that contains it.
+     * 
+     * <p>If this channel's file resides on a local storage device then when this method returns it is guaranteed that
+     * all changes made to the file since this channel was created, or since this method was last invoked, will have
+     * been written to that device.  This is useful for ensuring that critical information is not lost in the event of
+     * a system crash.
+     * 
+     * <p>If the file does not reside on a local device then no such guarantee is made.
+     * 
+     * <p> Invoking this method may cause an I/O operation to occur even if the channel was only opened for reading.
+     * Some operating systems, for example, maintain a last-access time as part of a file's metadata, and this time is
+     * updated whenever the file is read.  Whether or not this is actually done is system-dependent and is therefore
+     * unspecified.
+     * 
+     * @param metaData  If <tt>true</tt> then this method is required to force changes to both the file's content and
+     *                  metadata to be written to storage; otherwise, it need only force content changes to be written
+     * @return  A future object representing the pending result.  The future's get method will block and any registered
+     *          callbacks will be invoked when the sync has completed.
+     * @throws AioException  Thrown if an error occurs scheduling the sync operation.
+     */
+    public abstract SyncFuture sync(boolean metaData) throws AioException;
 
-    public abstract ByteBufferFuture read(ByteBuffer buffer, long position);
+    /**
+     * Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
+     * 
+     * <p>This method initiates the reading of a sequence of bytes from this channel into the given buffer, starting at
+     * the given file position. The method returns a {@link ByteBufferFuture} representing the pending result of the
+     * read operation. The ByteBufferFuture's @{link ByteBufferFuture#get()} method will return the number of bytes
+     * read, possibly zero, or -1 if the given position is greater than or equal to the file's size at the time that
+     * the read is attempted.
+     * 
+     * @param buffer  The buffer to which bytes read from the file will be written
+     * @param position  The position in the file to start reading, must be non-negative
+     * @return  A ByteBufferFuture object represning the pending result of the read opertion
+     * @throws AioException  Thrown if there's an error scheduling the read
+     */
+    public abstract ByteBufferFuture read(ByteBuffer buffer, long position) throws AioException;
 
-    public BatchFuture read(ByteBufferPosition... byteBufferPositions) {
+    /**
+     * Schedules multiple reads to be done in a single call.  Each {@link ByteBufferPosition} specifies a buffer
+     * and file position.  Equivalent to:
+     * 
+     * <pre>
+     * return read(byteBufferPositions, 0, byteBufferPositions.length);
+     * </pre>
+     * @return  TODO To be determined
+     * @see #read(ByteBufferPosition[], int, int)
+     */
+    public BatchFuture read(ByteBufferPosition... byteBufferPositions) throws AioException {
         return read(byteBufferPositions, 0, byteBufferPositions.length);
     }
 
-    public abstract BatchFuture read(ByteBufferPosition[] byteBufferPositions, int offset, int length);
+    /**
+     * Schedules multiple reads to be done in a single call.  Each {@link ByteBufferPosition} specifies a buffer
+     * and file position.  A sequence of bytes is read from the channel for each ByteBufferPosition starting at the
+     * ByteBufferPosition's file position and stored in the ByteBufferPosition's buffer. 
+     * 
+     * <p>This method is able to schedule multiple reads with a single call.  On some platforms this can allow multiple
+     * reads to be sheduled with a single system call.
+     * 
+     * <p>TODO Determin what the future's get method should return.
+     * 
+     * @param byteBufferPositions  The ByteBufferPositions that indicate what buffers to read data into and which file
+     *                             positions in the file should be read
+     * @param offset  The offset within the byteBufferPositions array of the first byteBufferPositions into which date
+     *                are to be transferred; must be non-negative and no larger than <tt>byteBufferPositions.length</tt>
+     * @param length  The maximum number of byteBufferPositions to be accessed; must be non-negative and no larger than
+     *                <tt>dsts.length - offset</tt>
+     * @return  TODO To be determined
+     */
+    public abstract BatchFuture read(ByteBufferPosition[] byteBufferPositions, int offset, int length)
+            throws AioException;
 
+    /**
+     * Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
+     * 
+     * <p>This method initiates the writing of a sequence of bytes to this channel from the given buffer, starting at
+     * the given file position. The method returns a {@link ByteBufferFuture} representing the pending result of the
+     * write operation. The ByteBufferFuture's @{link ByteBufferFuture#get()} method will return the number of bytes
+     * written, possibly zero, or -1 if the given position is greater than or equal to the file's size at the time that
+     * the write is attempted.
+     * 
+     * @param buffer  The buffer from which bytes file will be written to the file
+     * @param position  The position in the file to start writing, must be non-negative
+     * @return  A ByteBufferFuture object represning the pending result of the write opertion
+     * @throws AioException  Thrown if there's an error scheduling the write
+     */
     public abstract ByteBufferFuture write(ByteBuffer buffer, long position);
 
     public BatchFuture write(ByteBufferPosition... byteBufferPositions) {
@@ -116,11 +287,38 @@
 
     public abstract BatchFuture write(ByteBufferPosition[] byteBufferPositions, int offset, int length);
 
+    /**
+     * A utility method for blocking on multiple {@link AioFuture} objects.  The current thread blocks until all the
+     * AioFuture objects have completed.
+     * 
+     * @param futures  The AioFuture's to wait on.
+     * @throws InterruptedException  Thrown if the current thread get interrupted while waiting on the futures
+     * @throws ExecutionException  Thrown if at least one of the futures fails whil waiting for it to finish.
+     */
     public static void suspend(AioFuture... futures) throws InterruptedException, ExecutionException {
         for (AioFuture future : futures) {
             future.get();
         }
     }
 
-    public abstract TruncateFuture truncate(long size);
+    /**
+     * Truncates the file to a given size.
+     * 
+     * <p>This method initiates the truncation of this channel's file to the given size, returning a {@link
+     * TruncateFuture} representing the pending result of the operation. The TruncateFuture's get method will return
+     * null upon completion. 
+     * 
+     * @param size  The new size, a non-negative byte count
+     * @return  A TruncateFuture object representing the pending result
+     * @throws AioException  Thrown if an occurs occurs scheduling the truncation
+     */
+    public abstract TruncateFuture truncate(long size) throws AioException;
+
+    /**
+     * Closes the file channel.
+     * 
+     * @throws AioException  Thrown if there's an error closing the channel.
+     */
+    public abstract void close() throws AioException;
+
 }

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java Mon Jan 22 09:12:35 2007
@@ -21,10 +21,24 @@
 
 import java.nio.ByteBuffer;
 
+/**
+ * Holds a buffer and file position pair.  The interface is often used with the 
+ * 
+ * @author mheath
+ */
 public interface ByteBufferPosition {
 
+    /**
+     * Fetches the buffer associated with this <tt>ByteBufferPosition</tt>.
+     * 
+     * @return  The buffer associated with this <tt>ByteBufferPosition</tt>.
+     */
     ByteBuffer getByteBuffer();
-	
+
+    /**
+     * 
+     * @return
+     */
     long position();
 
 }

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java?view=diff&rev=498707&r1=498706&r2=498707
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java Mon Jan 22 09:12:35 2007
@@ -19,9 +19,27 @@
  */
 package org.apache.aio;
 
+/**
+ * Stores the possible flags used for opening an {@link AsynchronousFileChannel}.
+ * 
+ * @author mheath
+ */
 public enum Flags {
-	READ_ONLY,
-	WRITE_ONLY,
-	READ_WRITE,
-	APPEND
+    /**
+     * Indicates the {@link AsynchronousFileChannel} should be opened in read-only mode.
+     */
+    READ_ONLY,
+    /**
+     * Indicates the {@link AsynchronousFileChannel} should be opened in write-only mode.
+     */
+    WRITE_ONLY,
+    /**
+     * Indicates the {@link AsynchronousFileChannel} should be opened in read-write mode.
+     */
+    READ_WRITE,
+    /**
+     * If the {@link AsynchronousFileChannel} is opened for writing, indicates if the file should be appeneded instead
+     * of truncating the file to 0 bytes when opened.
+     */
+    APPEND
 }