title: Remove the 1st line of a file in Java regardless of newline type without calling exec or iterating over it line by line
body: <p>I'm trying to write a method in Java that removes the first line of a file.</p>
  
  <p>First idea (rejected because calling .exec is not a good practice)</p>
  
  <pre><code>public void removeHeader(String fileName) throws IOException, InterruptedException {
      if (StringUtils.isBlank(fileName)) {
          throw new IllegalArgumentException("fileName was empty");
      }
  
      Process p = Runtime.getRuntime().exec("sed -i 1d " + fileName);
  
      if (p.waitFor() != 0) {
          throw new IOException("Failed to remove the header from " + fileName);
      }
  }
  </code></pre>
  
  <p>Second idea (rejected in CR because iterating over every line and writing it into a new file is slow and not stylish).</p>
  
  <pre><code>public void removeHeader(String fileName) throws IOException, InterruptedException {
      if (StringUtils.isBlank(fileName)) {
          throw new IllegalArgumentException("fileName was empty");
      }
  
      File inFile = new File(fileName);
      File tempFile = new File(inFile.getAbsolutePath() + ".tmp");
  
      BufferedReader br = null;
      PrintWriter pw = null;
  
      try {
          br = new BufferedReader(new FileReader(fileName));
          pw = new PrintWriter(new FileWriter(tempFile));
  
          String line = null;
          boolean first = true;
          while ((line = br.readLine()) != null) {
              if (!first) {
                  pw.println(line);
                  pw.flush();
              }
  
              first = false;
          } 
      }
      finally {
          pw.close();
          br.close();
      }
  
      if (inFile.exists() &amp;&amp; tempFile.exists()) {
          inFile.delete();
          tempFile.renameTo(inFile);
      }
  }
  </code></pre>
  
  <p>I want my solution to work regardless of newline format and be easy to read. Is there a solution that meets all these needs?</p>