You are viewing a plain text version of this content. The canonical link for it is here.
Posted to droids-commits@incubator.apache.org by to...@apache.org on 2012/05/14 14:37:01 UTC

svn commit: r1338225 - /incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java

Author: tobr
Date: Mon May 14 14:37:01 2012
New Revision: 1338225

URL: http://svn.apache.org/viewvc?rev=1338225&view=rev
Log:
added documentation

Modified:
    incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java

Modified: incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java?rev=1338225&r1=1338224&r2=1338225&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java (original)
+++ incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/file/FileProtocol.java Mon May 14 14:37:01 2012
@@ -29,10 +29,16 @@ import org.apache.droids.api.ManagedCont
 import org.apache.droids.api.Parse;
 import org.apache.droids.api.Protocol;
 
+/**
+ * 
+ * Protocol implementation for system-independent
+ * file and directory pathnames based on java.io.File.
+ * 
+ * @version 1.0
+ * 
+ */
 public class FileProtocol implements Protocol {
 
-  FileInputStream fileInputStream=null;
-
   @Override
   public boolean isAllowed(URI uri) {
     File file = new File(extractLocation(uri));
@@ -45,6 +51,12 @@ public class FileProtocol implements Pro
     return new FileContentEntity(file);
   }
 
+  /**
+   * Removes the scheme from the URI to get the pathname of the file.
+   * 
+   * @param uri The URI of the file
+   * @return	The pathname of the file
+   */
   private String extractLocation(URI uri) {
     String location = uri.toString();
     final int start = location.indexOf("://");
@@ -54,14 +66,36 @@ public class FileProtocol implements Pro
     return location;
   }
 
+  /**
+   * 
+   * Content entity representing the body of a file.
+   * 
+   */
   static class FileContentEntity implements ManagedContentEntity {
     
+	/**
+	 * The file represented by the ContentEntity
+	 */
     private final File file;
+    /**
+     * The mime-type of the file
+     */
     private final String mimeType;
+    /**
+     * The charset of the file
+     */
     private final String charset;
-
+    /**
+     * The parse object
+     */
     private Parse parse = null;
     
+    /**
+     * Creates a new FileContentEntity instance for the give file.
+     * 
+     * @param file 
+     * @throws IOException
+     */
     public FileContentEntity(File file) throws IOException {
       super();
       this.file = file;