code: public static void encryptToFile(String path, byte[] buf, String key) {
          try {
              FileOutputStream fos = new FileOutputStream(path);
              fos.write(encrypt(buf, key).getBytes());
              fos.close();
          } catch (final Exception e) {
              logger.warn("Could not encrypt to file {}", path, e);
          }
      }
docs: Encrypts the byte[] to a file.
  
  @param path The destination path.
  @param buf  The buffer.
  @param key  The key.