User: user57  
  Date: 02/04/05 21:19:35

  Modified:    src/main/org/jboss/net/protocol/file FileURLConnection.java
  Log:
   o Added more comments
   o Using file.getPath() instead of url.getPath() + translation
  
  Revision  Changes    Path
  1.5       +26 -11    
jboss-common/src/main/org/jboss/net/protocol/file/FileURLConnection.java
  
  Index: FileURLConnection.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-common/src/main/org/jboss/net/protocol/file/FileURLConnection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileURLConnection.java    5 Apr 2002 15:28:36 -0000       1.4
  +++ FileURLConnection.java    6 Apr 2002 05:19:35 -0000       1.5
  @@ -26,9 +26,9 @@
   
   /**
    * Provides local file access via URL semantics, correctly returning
  - * lastModified.
  + * the last modified time of the underlying file.
    *
  - * @version <tt>$Revision: 1.4 $</tt>
  + * @version <tt>$Revision: 1.5 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public class FileURLConnection
  @@ -45,6 +45,18 @@
         doOutput = false;
      }
   
  +   /**
  +    * Returns the underlying file for this connection.
  +    */
  +   public File getFile() {
  +      return file;
  +   }
  +
  +   /**
  +    * Checks if the underlying file for this connection exists.
  +    *
  +    * @throws FileNotFoundException
  +    */
      public void connect() throws IOException {
         if (connected) return;
   
  @@ -67,6 +79,10 @@
         return new FileOutputStream(file);
      }
   
  +   /**
  +    * Provides support for returning the value for the
  +    * <tt>last-modified</tt> header.
  +    */
      public String getHeaderField(final String name) {
         if (name.equalsIgnoreCase("last-modified")) {
            return String.valueOf(getLastModified());
  @@ -75,19 +91,18 @@
         return super.getHeaderField(name);
      }
   
  -   /** Return a permission for both read,write since both input
  -   and output streams are supported.
  -   */
  +   /** 
  +    * Return a permission for both read & write since both
  +    * input and output streams are supported.
  +    */
      public Permission getPermission() throws IOException
      {
  -      String path = url.getPath();
  -      // See if the seperator char matches the URL '/'
  -      if( File.separatorChar != '/' )
  -         path = path.replace('/', File.separatorChar);
  -      Permission p = new FilePermission(path, "read,write");
  -      return p;
  +      return new FilePermission(file.getPath(), "read,write");
      }
   
  +   /**
  +    * Returns the last modified time of the underlying file.
  +    */
      public long getLastModified() {
         return file.lastModified();
      }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to