The SuperCaesar cipher is just like the Caesar cipher, except that the key value is incremented in each step. For example, if the initial key is 3, the key for the next byte is 4, and so on. The encryption of "eve" with a key of 3 would be "hzj".

Complete the following class that computes this cipher. Note that you need separate encryption and decryption methods.

The test procedure turns strings into in-memory streams of byte arrays. This is convenient for testing, and it does not affect the implementation of the cipher class.

Complete the following file:

import; import; import; import; import; /** This class encrypts files using the SuperCaesar cipher. */ public class SuperCaesarCipher { /** Constructs a cipher object with a given key. @param aKey the encryption key */ public SuperCaesarCipher(int aKey) { key = aKey; } /** Encrypts or decrypts the contents of a stream. @param in the input stream @param out the output stream @param decrypt true to decrypt, false to encrypt */ public void processStream(InputStream in, OutputStream out, boolean decrypt) throws IOException { boolean done = false; while (!done) { int next =; if (next == -1) done = true; else { byte b = (byte) next; byte c; if (decrypt) c = decrypt(b); else c = encrypt(b); out.write(c); } } } /** Encrypts a byte. @param b the byte to encrypt @return the encrypted byte */ public byte encrypt(byte b) { // your work here } /** Decrypts a byte. @param b the byte to decrypt @return the decrypted byte */ public byte decrypt(byte b) { // your work here } private int key; // this method is used to check your work public static String check(String input, int key, boolean decrypt) { try { InputStream inStream = new ByteArrayInputStream(input.getBytes()); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); SuperCaesarCipher cipher = new SuperCaesarCipher(key); cipher.processStream(inStream, outStream, decrypt); inStream.close(); outStream.close(); return outStream.toString(); } catch (IOException exception) { return "Error"; } } }