BSD License
For Conceal software
Copyright (c) 2014, Facebook, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that...
If you think the Android project conceal listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright (c) 2014, Facebook, Inc.//www.java2s.com
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/package com.facebook.crypto.benchmarks.mac.streams;
import javax.crypto.Mac;
import java.io.IOException;
import java.io.OutputStream;
publicclass MacLayeredOutputStream extends OutputStream {
private Mac mMac;
private OutputStream mOs;
public MacLayeredOutputStream(Mac mac, OutputStream os) {
mMac = mac;
mOs = os;
}
@Override
publicvoid close() throws IOException {
mOs.close();
}
@Override
publicvoid flush() throws IOException {
mOs.flush();
}
@Override
publicvoid write(byte[] buffer) throws IOException {
write(buffer, 0, buffer.length);
}
@Override
publicvoid write(byte[] buffer, int offset, int count) throws IOException {
mOs.write(buffer, offset, count);
mMac.update(buffer, offset, count);
}
@Override
publicvoid write(int oneByte) throws IOException {
mOs.write(oneByte);
mMac.update((byte) oneByte);
}
}