@Override public void recv(final long bytes) { recv += bytes; super.recv(bytes); }
@Override public ChecksumCompute checksum(final Path file) { return ChecksumComputeFactory.get(HashAlgorithm.md5); } }
public static ChecksumCompute get(final HashAlgorithm algorithm) { switch(algorithm) { case md5: return new MD5FastChecksumCompute(); case sha1: return new SHA1ChecksumCompute(); case sha256: return new SHA256ChecksumCompute(); case sha512: return new SHA512ChecksumCompute(); case crc32: return new CRC32ChecksumCompute(); default: return new DisabledChecksumCompute(); } } }
public StreamGobbler(InputStream is) { this.is = is; GobblerThread t = new GobblerThread(); t.setDaemon(true); t.start(); }
@Override public void recv(final long bytes) { delegate.recv(bytes); } }
@Override public void sent(final long bytes) { delegate.sent(bytes); }
@Override public void sent(final long bytes) { sent += bytes; super.sent(bytes); }
/** * Creates a new bandwidth throttle at the given throttle rate. * The default windows size T is used. The bytes per windows N * is calculated from bytesPerSecond. * * @param bytesPerSecond the limits in bytes (not bits!) per second * (not milliseconds!) */ public BandwidthThrottle(float bytesPerSecond) { this.setRate(bytesPerSecond); }
@Override public void write(byte[] buffer) throws IOException { this.write(buffer, 0, buffer.length); }
@Override public ChecksumCompute checksum(final Path file) { return ChecksumComputeFactory.get(HashAlgorithm.md5); } }
@Override public ChecksumCompute checksum(final Path file) { return ChecksumComputeFactory.get(HashAlgorithm.sha256); } }
@Override public ChecksumCompute checksum(final Path file) { return ChecksumComputeFactory.get(HashAlgorithm.md5); }
@Override public ChecksumCompute checksum(final Path file) { return ChecksumComputeFactory.get(HashAlgorithm.sha1); }