commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp FtpFileObject.java
Date Fri, 14 Mar 2003 01:07:44 GMT
adammurdoch    2003/03/13 17:07:44

  Modified:    vfs/src/java/org/apache/commons/vfs/provider/ftp
                        FtpFileObject.java
  Log:
  Added support for last-modified time for FTP files.
  
  Patch submitted by Jeff Barrett.
  
  Revision  Changes    Path
  1.15      +26 -0     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
  
  Index: FtpFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- FtpFileObject.java	23 Feb 2003 00:40:38 -0000	1.14
  +++ FtpFileObject.java	14 Mar 2003 01:07:44 -0000	1.15
  @@ -58,6 +58,10 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.util.Calendar;
  +import java.util.Date;
  +import java.util.GregorianCalendar;
  +
   import org.apache.commons.net.ftp.FTPClient;
   import org.apache.commons.net.ftp.FTPFile;
   import org.apache.commons.vfs.FileName;
  @@ -301,6 +305,28 @@
       protected long doGetContentSize() throws Exception
       {
           return fileInfo.getSize();
  +    }
  +
  +    /**
  +     * get the last modified time on an ftp file
  +     * @see org.apache.commons.vfs.provider.AbstractFileObject#doGetLastModifiedTime()
  +     */
  +    protected long doGetLastModifiedTime() throws Exception
  +    {
  +        return ( fileInfo.getTimestamp().getTime().getTime() );
  +    }
  +
  +    /**
  +     * get the last modified time on an ftp file
  +     * @param modtime the time to set on the ftp file
  +     * @see org.apache.commons.vfs.provider.AbstractFileObject#doSetLastModifiedTime(long)
  +     */
  +    protected void doSetLastModifiedTime( final long modtime ) throws Exception
  +    {
  +        final Date d = new Date( modtime );
  +        final Calendar c = new GregorianCalendar();
  +        c.setTime( d );
  +        fileInfo.setTimestamp( c );
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message