Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.palantir.crypto2.cipher.CipherStreamSupplierImpl;
import com.palantir.crypto2.cipher.SeekableCipher;
import java.io.FilterOutputStream;
import java.io.IOException;
import javax.crypto.Cipher;
import org.apache.hadoop.fs.FSDataOutputStream;

Expand All @@ -39,4 +40,14 @@ public FsCipherOutputStream(FSDataOutputStream delegate, SeekableCipher cipher)
super(supplier.getOutputStream(delegate, cipher.initCipher(Cipher.ENCRYPT_MODE)));
}

@Override
public void write(byte[] bytes, int off, int len) throws IOException {
out.write(bytes, off, len);
}

@Override
public void write(byte[] bytes) throws IOException {
out.write(bytes);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eclipse user?

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.palantir.crypto2.cipher.CipherStreamSupplier;
import com.palantir.crypto2.cipher.SeekableCipher;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
Expand All @@ -37,6 +38,8 @@

public final class FsCipherOutputStreamTest {

private static final byte[] bytes = "bytes".getBytes(StandardCharsets.UTF_8);

private FSDataOutputStream os;
private Cipher initCipher;
private SeekableCipher seekableCipher;
Expand Down Expand Up @@ -72,4 +75,16 @@ public void testWrite() throws IOException {
verify(cos).write(0);
}

@Test
public void testWrite_callsWriteWithLength() throws IOException {
scos.write(bytes, 0, bytes.length);
verify(cos).write(bytes, 0, bytes.length);
}

@Test
public void testWrite_callsBatchWrite() throws IOException {
scos.write(bytes);
verify(cos).write(bytes);
}

}