Changeset 2523
- Timestamp:
- Jun 25, 2014, 1:46:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.xfiles/trunk/src/net/sf/basedb/xfiles/ftp/FtpConnectionManager.java
r2521 r2523 37 37 import net.sf.basedb.util.uri.CloseResourceInputStream; 38 38 import net.sf.basedb.util.uri.ConnectionParameters; 39 import net.sf.basedb.util.uri. ConnectionManager;39 import net.sf.basedb.util.uri.ResumableConnectionManager; 40 40 import net.sf.basedb.util.uri.UriMetadata; 41 41 import net.sf.basedb.xfiles.MultiCloseable; … … 50 50 */ 51 51 public class FtpConnectionManager 52 implements ConnectionManager52 implements ResumableConnectionManager 53 53 { 54 54 … … 64 64 65 65 /* 66 From the UriHandler interface67 ----------------------------- 66 From the ResumableConnectionManager interface 67 --------------------------------------------- 68 68 */ 69 69 @Override … … 75 75 @Override 76 76 public InputStream getInputStream() 77 throws IOException 78 { 79 return getInputStream(0); 80 } 81 82 @Override 83 public InputStream getInputStream(long offset) 77 84 throws IOException 78 85 { … … 83 90 { 84 91 ftp = connect(uri, parameters); 85 stream = new CloseResourceInputStream(startDownload(ftp, uri.getPath() ), new FTPClientCloseable(ftp));92 stream = new CloseResourceInputStream(startDownload(ftp, uri.getPath(), offset), new FTPClientCloseable(ftp)); 86 93 } 87 94 finally … … 207 214 reading it. The download is started in a separate thread. 208 215 */ 209 private InputStream startDownload(final FTPClient ftp, final String file )216 private InputStream startDownload(final FTPClient ftp, final String file, final long offset) 210 217 { 211 218 final PipedInputStream in = new PipedInputStream(XFiles.DEFAULT_BUFFER_SIZE); … … 218 225 { 219 226 OutputStream out = new PipedOutputStream(in); 220 ftp.download(file, out, 0, null);227 ftp.download(file, out, offset, null); 221 228 } 222 229 catch (Exception ex)
Note: See TracChangeset
for help on using the changeset viewer.