package aalg.crypto;

import java.io.IOException;
import java.io.OutputStream;

public class Pkcs7PaddingWriter extends BytePaddingWriter {
	
	@Override
	protected void writePaddingToStream() throws IOException { 
		final int paddingBytes = (filledBytes == 0) ? blockLength : blockLength - filledBytes;
				
		for (int i = 0; i < paddingBytes; i++)
			unpaddedStream.write(paddingBytes);
	}
}
