@Test public void testAcceptExistsFalse() throws Exception { ResumeFilter f = new ResumeFilter(new DisabledDownloadSymlinkResolver(), new NullSession(new Host(new TestProtocol()))); Path p = new Path("a", EnumSet.of(Path.Type.file)); p.attributes().setSize(2L); assertTrue(f.accept(p, new NullLocal("~/Downloads", "a") { @Override public boolean exists() { return false; } }, new TransferStatus())); }
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { final PathAttributes attributes = attribute.find(file); if(local.attributes().getSize() == attributes.getSize()) { if(Checksum.NONE != attributes.getChecksum()) { final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm); if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum())); } return false; } else { log.warn(String.format("Checksum mismatch for %s and %s", file, local)); } } else { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize())); } return false; } } } } return super.accept(file, local, parent); }
ResumeFilter extends AbstractDownloadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { final PathAttributes attributes = attribute.find(file); if(local.attributes().getSize() == attributes.getSize()) { if(Checksum.NONE != attributes.getChecksum()) { final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm); if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum())); } return false; } else { log.warn(String.format("Checksum mismatch for %s and %s", file, local)); } } else { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize())); } return false; } } } } return super.accept(file, local, parent); } }
ResumeFilter extends AbstractDownloadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { final PathAttributes attributes = attribute.find(file); if(local.attributes().getSize() == attributes.getSize()) { if(Checksum.NONE != attributes.getChecksum()) { final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm); if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum())); } return false; } else { log.warn(String.format("Checksum mismatch for %s and %s", file, local)); } } else { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize())); } return false; } } } } return super.accept(file, local, parent); } ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options, final Download download); }
ResumeFilter extends AbstractDownloadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { final PathAttributes attributes = attribute.find(file); if(local.attributes().getSize() == attributes.getSize()) { if(Checksum.NONE != attributes.getChecksum()) { final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm); if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum())); } return false; } else { log.warn(String.format("Checksum mismatch for %s and %s", file, local)); } } else { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize())); } return false; } } } } return super.accept(file, local, parent); } ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options, final Download download); @Override boolean accept(final Path file, final Local local, final TransferStatus parent); @Override TransferStatus prepare(final Path file, final Local local, final TransferStatus parent, final ProgressListener progress); }
ResumeFilter extends AbstractDownloadFilter { @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { final PathAttributes attributes = attribute.find(file); if(local.attributes().getSize() == attributes.getSize()) { if(Checksum.NONE != attributes.getChecksum()) { final ChecksumCompute compute = ChecksumComputeFactory.get(attributes.getChecksum().algorithm); if(compute.compute(local.getInputStream(), parent).equals(attributes.getChecksum())) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with checksum %s", file, local.attributes().getChecksum())); } return false; } else { log.warn(String.format("Checksum mismatch for %s and %s", file, local)); } } else { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s with local size %d", file, local.attributes().getSize())); } return false; } } } } return super.accept(file, local, parent); } ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options);  ResumeFilter(final SymlinkResolver<Path> symlinkResolver, final Session<?> session,
                        final DownloadFilterOptions options, final Download download); @Override boolean accept(final Path file, final Local local, final TransferStatus parent); @Override TransferStatus prepare(final Path file, final Local local, final TransferStatus parent, final ProgressListener progress);  }