public CopyResult(long startMillis, long transferAmountInBytes, CopyDirection direction) { this.stopMillis = System.currentTimeMillis(); Assert.isTrue(stopMillis >= startMillis); Assert.positive(startMillis); Assert.notNegative(transferAmountInBytes); Assert.noNulls(direction); this.startMillis = startMillis; this.amountInBytes = transferAmountInBytes; this.elapsedMillis = stopMillis - startMillis; this.direction = direction; }
private static void validate(ChannelContext ctx) { checkNotBlank(ctx.hostname, "hostname"); checkNotBlank(ctx.encoding, "encoding"); Assert.noNulls(ctx.getUsername(), ctx.getConnectTimeout(), ctx.getOptions(), ctx.getKnownHosts(), ctx.getConfig(), ctx.getPrivateKeyFiles(), ctx.getPrivateKeys()); Assert.isPort(ctx.getPort()); Assert.positive(ctx.getWaitForClosedSleepMillis()); Assert.notEncrypted(ctx.getPrivateKeys()); if (ctx.isUseConfigFile()) { Assert.exists(ctx.getConfig()); Assert.isTrue(ctx.getConfig().canRead(), "[" + ctx.getConfig() + "] exists but is not readable"); } if (ctx.getConnectTimeout().isPresent()) { Assert.positive(ctx.getConnectTimeout().get()); } }