package example5_3javaiodecorator; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; /** * @author hornick * This output stream decorator encrypts an wrapped output stream */ public class EncryptedOutputStream extends FilterOutputStream { private String encryptionKey; // the "key" to use for encryption private Queue shifter; // Encryption "barrel". Note: Queue is abstract /** * constructs the output stream encrypter * @param key (ignored currently) * @param wrappedStream */ public EncryptedOutputStream(String key, OutputStream wrappedStream) { super(wrappedStream); // TODO: This shifter is unused. Use it. // fill the barrel with the encryption key shifter = new LinkedList(); encryptionKey = key; for( int c = 0; c