Changeset 2522
- Timestamp:
- Jun 25, 2014, 1:45:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.xfiles/trunk/src/net/sf/basedb/xfiles/sftp/SftpConnectionManager.java
r2520 r2522 36 36 import net.sf.basedb.util.uri.CloseResourceInputStream; 37 37 import net.sf.basedb.util.uri.ConnectionParameters; 38 import net.sf.basedb.util.uri. ConnectionManager;38 import net.sf.basedb.util.uri.ResumableConnectionManager; 39 39 import net.sf.basedb.util.uri.UriMetadata; 40 40 import net.sf.basedb.xfiles.MultiCloseable; … … 51 51 */ 52 52 public class SftpConnectionManager 53 implements ConnectionManager53 implements ResumableConnectionManager 54 54 { 55 55 … … 65 65 66 66 /* 67 From the UriHandler interface68 ----------------------------- 67 From the ResumableConnectionManager interface 68 --------------------------------------------- 69 69 */ 70 70 @Override … … 76 76 @Override 77 77 public InputStream getInputStream() 78 throws IOException 79 { 80 return getInputStream(0); 81 } 82 83 @Override 84 public InputStream getInputStream(long offset) 78 85 throws IOException 79 86 { … … 88 95 sftp = ssh.newSFTPClient(); 89 96 remote = sftp.open(uri.getPath(), EnumSet.of(OpenMode.READ)); 97 // Constructor is only accepting an 'int' parameter so we need to use skip() instead 98 InputStream tmp = remote.new RemoteFileInputStream(); 99 if (offset > 0) tmp.skip(offset); 90 100 stream = new CloseResourceInputStream( 91 new BufferedInputStream( remote.new RemoteFileInputStream(), XFiles.DEFAULT_BUFFER_SIZE),101 new BufferedInputStream(tmp, XFiles.DEFAULT_BUFFER_SIZE), 92 102 new MultiCloseable(remote, sftp, ssh)); 93 103 }
Note: See TracChangeset
for help on using the changeset viewer.