You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2016/12/05 13:10:53 UTC

mina git commit: Added some missing javadoc

Repository: mina
Updated Branches:
  refs/heads/2.0 e29bc0315 -> 4b96641c4


Added some missing javadoc

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/4b96641c
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/4b96641c
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/4b96641c

Branch: refs/heads/2.0
Commit: 4b96641c4fae2a06b1ffef49b64d0acfd5cdb5ab
Parents: e29bc03
Author: Emmanuel L�charny <el...@symas.com>
Authored: Mon Dec 5 14:09:21 2016 +0100
Committer: Emmanuel L�charny <el...@symas.com>
Committed: Mon Dec 5 14:09:21 2016 +0100

----------------------------------------------------------------------
 .../mina/core/file/DefaultFileRegion.java       | 46 ++++++++++++++++++--
 .../org/apache/mina/core/file/FileRegion.java   |  3 +-
 .../mina/core/file/FilenameFileRegion.java      | 23 +++++++++-
 3 files changed, 65 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/4b96641c/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java b/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java
index d50b6dc..48ebd90 100644
--- a/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java
+++ b/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java
@@ -23,25 +23,42 @@ import java.io.IOException;
 import java.nio.channels.FileChannel;
 
 /**
- * TODO Add documentation
+ * Manage a File to be sent to a remote host. We keep a track on the current
+ * position, and the number of already written bytes.
  * 
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class DefaultFileRegion implements FileRegion {
-
+    /** The channel used to manage the file */
     private final FileChannel channel;
 
+    /** The original position in the file */
     private final long originalPosition;
 
+    /** The position in teh file */
     private long position;
 
+    /** The number of bytes remaining to write */
     private long remainingBytes;
 
+    /**
+     * Creates a new DefaultFileRegion instance
+     * 
+     * @param channel The channel mapped over the file
+     * @throws IOException If we had an IO error
+     */
     public DefaultFileRegion(FileChannel channel) throws IOException {
         this(channel, 0, channel.size());
     }
 
+    /**
+     * Creates a new DefaultFileRegion instance
+     * 
+     * @param channel The channel mapped over the file
+     * @param position The position in teh file
+     * @param remainingBytes The remaining bytes
+     */
     public DefaultFileRegion(FileChannel channel, long position, long remainingBytes) {
         if (channel == null) {
             throw new IllegalArgumentException("channel can not be null");
@@ -61,29 +78,52 @@ public class DefaultFileRegion implements FileRegion {
         this.remainingBytes = remainingBytes;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public long getWrittenBytes() {
         return position - originalPosition;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public long getRemainingBytes() {
         return remainingBytes;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public FileChannel getFileChannel() {
         return channel;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public long getPosition() {
         return position;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void update(long value) {
         position += value;
         remainingBytes -= value;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public String getFilename() {
         return null;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/4b96641c/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java b/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java
index d85da4c..a338be9 100644
--- a/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java
+++ b/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java
@@ -49,8 +49,7 @@ public interface FileRegion {
      * {@link #getWrittenBytes()} by the given amount and decreases the value
      * returned by {@link #getRemainingBytes()} by the given {@code amount}.
      * 
-     * @param amount
-     *            The new value for the file position.
+     * @param amount The new value for the file position.
      */
     void update(long amount);
 

http://git-wip-us.apache.org/repos/asf/mina/blob/4b96641c/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java b/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java
index cbbe46a..b197a99 100644
--- a/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java
+++ b/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java
@@ -24,8 +24,8 @@ import java.io.IOException;
 import java.nio.channels.FileChannel;
 
 /**
- * TODO Add documentation
- * 
+ * Manage a File to be sent to a remote host. We keep a track on the current
+ * position, and the number of already written bytes.
  * 
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
@@ -34,10 +34,25 @@ public class FilenameFileRegion extends DefaultFileRegion {
 
     private final File file;
 
+    /**
+     * Create a new FilenameFileRegion instance
+     * 
+     * @param file The file to manage
+     * @param channel The channel over the file
+     * @throws IOException If we got an IO error
+     */
     public FilenameFileRegion(File file, FileChannel channel) throws IOException {
         this(file, channel, 0, file.length());
     }
 
+    /**
+     * Create a new FilenameFileRegion instance
+     * 
+     * @param file The file to manage
+     * @param channel The channel over the file
+     * @param position The position in teh file
+     * @param remainingBytes The remaining bytes
+     */
     public FilenameFileRegion(File file, FileChannel channel, long position, long remainingBytes) {
         super(channel, position, remainingBytes);
 
@@ -48,6 +63,10 @@ public class FilenameFileRegion extends DefaultFileRegion {
         this.file = file;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public String getFilename() {
         return file.getAbsolutePath();
     }