Search in sources :

Example 6 with NullOutputStream

use of com.google.common.io.NullOutputStream in project conceal by facebook.

the class CipherWriteBenchmark method setUp.

@Override
public void setUp() throws Exception {
    Random random = new Random();
    mData = new byte[size];
    random.nextBytes(mData);
    mNullOutputStream = new NullOutputStream();
    mHMAC = HMAC.getInstance();
    mNativeGCMCipherHelper = NativeGCMCipherHelper.getInstance();
    mAESCipher = AESCipher.getInstance();
    Security.addProvider(new BouncyCastleProvider());
    mBCGCMCipher = BouncyCastleGCMCipher.getInstance();
}
Also used : Random(java.util.Random) NullOutputStream(com.google.common.io.NullOutputStream) BouncyCastleProvider(org.spongycastle.jce.provider.BouncyCastleProvider)

Example 7 with NullOutputStream

use of com.google.common.io.NullOutputStream in project cdap by caskdata.

the class ConfigurationJsonTool method main.

public static void main(String[] args) {
    String programName = System.getProperty("script", "ConfigurationJsonTool");
    Set<String> validArgument = Sets.newHashSet();
    validArgument.add(CDAP_CONFIG);
    validArgument.add(SECURITY_CONFIG);
    if (args.length != 1 || !(validArgument.contains(args[0]))) {
        System.err.println(String.format("Usage: %s (%s | %s)", programName, CDAP_CONFIG, SECURITY_CONFIG));
        System.exit(1);
    }
    PrintStream stdout = System.out;
    // Redirect the stdout to null to suppress any log outputs generated during the json generation
    System.setOut(new PrintStream(new NullOutputStream()));
    StringBuilder output = new StringBuilder();
    exportToJson(args[0], output);
    // Restore the stdout
    System.setOut(stdout);
    System.out.print(output);
}
Also used : PrintStream(java.io.PrintStream) NullOutputStream(com.google.common.io.NullOutputStream)

Aggregations

NullOutputStream (com.google.common.io.NullOutputStream)7 MacLayeredInputStream (com.facebook.crypto.benchmarks.mac.streams.MacLayeredInputStream)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 MacLayeredOutputStream (com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream)2 OutputStream (java.io.OutputStream)2 Mac (javax.crypto.Mac)2 PrintStream (java.io.PrintStream)1 Random (java.util.Random)1 BouncyCastleProvider (org.spongycastle.jce.provider.BouncyCastleProvider)1