code: public static OutputStream encrypt(OutputStream outputStream, byte[] key) {
          checkNotNull(outputStream);
          checkNotNull(key);
          checkArgument(key.length >= 5 && key.length <= 256);
          StreamCipher rc4 = new RC4Engine();
          rc4.init(true, new KeyParameter(key));
          return new CipherOutputStream(outputStream, rc4);
      }
docs: Encrypt output stream using RC4
  
  @param outputStream output stream to be encrypted
  @param key          rc4 key (40..2048 bits)
  @return encrypted output stream