commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Commons Wiki] Update of "SimpleSftpFileDownload" by KenTanaka
Date Tue, 29 Apr 2008 22:02:43 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.

The following page has been changed by KenTanaka:
http://wiki.apache.org/jakarta-commons/SimpleSftpFileDownload

The comment on the change is:
made alternative code more consistent with main example

------------------------------------------------------------------------------
  
  Note that there is an alternative method to casting fsManager to !DefaultFileSystemManager
and then calling close(). The release method could instead use {{{this.fsManager.closeFileSystem(this.fs);}}},
you would have to declare '''fs''' as a !FileSystem object in the class and set it from one
of the !FileObjects in the process routine:
  {{{
- FileObject src = fsManager.resolveFile(from);
+ FileObject src = null;
+ 
+ <-- In processing(), do your things, including src = children[0] -->
+ 
+ public void release() {
- FileSystem fs = null;
+     FileSystem fs = null;
- FileSystemManager fsm = null;
  
- <-- do your things -->
- 
- src.close(); // Seems to still work even if this line is omitted
+     this.src.close(); // Seems to still work even if this line is omitted
- fs = src.getFileSystem(); // This works even after the src is closed.
+     fs = this.src.getFileSystem(); // This works even after the src is closed.
- fsm = fs.getFileSystemManager();
- fsm.closeFileSystem(fs);
+     this.fsManager.closeFileSystem(fs);
+ }
  }}}
  
  = Compiling =

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


Mime
View raw message