code: public void toSrt(Path srtFile) {
          try (FileOutputStream fos = new FileOutputStream(srtFile.toFile());
               OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
               PrintWriter writer = new PrintWriter(osw)) {
              long counter = 1;
              for (Subtitle title : subtitleList) {
                  writer.println(counter);
                  writer.println(srtFormat.format(title.begin) + " --> " + srtFormat.format(title.end));
                  for (StyledString entry : title.listOfStrings) {
                      if (!entry.color.isEmpty()) {
                          writer.print("<font color=\"" + entry.color + "\">");
                      }
                      writer.print(entry.text);
                      if (!entry.color.isEmpty()) {
                          writer.print("</font>");
                      }
                      writer.println();
                  }
                  writer.println("");
                  counter++;
              }
          } catch (Exception ex) {
              Log.errorLog(201036470, ex, "File: " + srtFile);
          }
      }
docs: Convert internal representation into SubRip Text Format and save to file.