code: private void writeFile(final String fileName,
                           final byte[] bs,
                           final boolean append) throws IOException {
      FileOutputStream fstr = null;
  
      try {
        fstr = new FileOutputStream(fileName, append);
        fstr.write(bs);
  
        // Terminate key with newline
        fstr.write('\n');
  
        fstr.flush();
      } finally {
        if (fstr != null) {
          fstr.close();
        }
      }
    }
docs: Write a single string to a file. Used to write keys
  
  @param fileName   String file to write to
  @param bs         bytes to write
  @param append     true to add the key to the file.
  @throws IOException