@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { ctx.write(new EncryptedMessage(cos, msg, byteChannel), promise); }
@Override public long transferTo(WritableByteChannel target, long position) throws IOException { Preconditions.checkArgument(position == transfered(), "Invalid position."); do { if (currentEncrypted == null) { encryptMore(); } int bytesWritten = currentEncrypted.remaining(); target.write(currentEncrypted); bytesWritten -= currentEncrypted.remaining(); transferred += bytesWritten; if (!currentEncrypted.hasRemaining()) { currentEncrypted = null; byteEncChannel.reset(); } } while (transferred < count()); return transferred; }
@Override public long transferTo(WritableByteChannel target, long position) throws IOException { Preconditions.checkArgument(position == transferred(), "Invalid position."); do { if (currentEncrypted == null) { encryptMore(); } int bytesWritten = currentEncrypted.remaining(); target.write(currentEncrypted); bytesWritten -= currentEncrypted.remaining(); transferred += bytesWritten; if (!currentEncrypted.hasRemaining()) { currentEncrypted = null; byteEncChannel.reset(); } } while (transferred < count()); return transferred; }
@Override public long transferTo(WritableByteChannel target, long position) throws IOException { Preconditions.checkArgument(position == transferred(), "Invalid position."); do { if (currentEncrypted == null) { encryptMore(); } int bytesWritten = currentEncrypted.remaining(); target.write(currentEncrypted); bytesWritten -= currentEncrypted.remaining(); transferred += bytesWritten; if (!currentEncrypted.hasRemaining()) { currentEncrypted = null; byteEncChannel.reset(); } } while (transferred < count()); return transferred; }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { ctx.write(new EncryptedMessage(cos, msg, byteChannel), promise); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { ctx.write(new EncryptedMessage(cos, msg, byteChannel), promise); }