public static String identifyLineDelimiter(String fileContent){
  if (fileContent.matches("(?s).*(\\r\\n).*")) {
    return "\r\n";
  }
 else   if (fileContent.matches("(?s).*(\\n).*")) {
    return "\n";
  }
 else   if (fileContent.matches("(?s).*(\\r).*")) {
    return "\r";
  }
 else {
    return "\n";
  }
}

public static String identifyLineDelimiter ( String fileContent ) { if ( fileContent . matches ( "(?s).*(\\r\\n).*" ) ) { return "\r\n" ; } else if ( fileContent . matches ( "(?s).*(\\n).*" ) ) { return "\n" ; } else if ( fileContent . matches ( "(?s).*(\\r).*" ) ) { return "\r" ; } else { return "\n" ; } }
identify which line delimiter is used in a file
