public static void writeBufferToFile(String path, byte[] buffer) throws IOException {
    try (FileOutputStream os = new FileOutputStream(path)) {
      os.write(buffer);
    }
  }
public static void writeBufferToFile ( String path , byte [ ] buffer ) throws IOException { try ( FileOutputStream os = new FileOutputStream ( path ) ) { os . write ( buffer ) ; } }
Writes buffer to the given file path.

@param path file path to write the data
@param buffer raw data