FileAnalyser { 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"; } }  static String identifyLineDelimiter(String fileContent); static String identifyLineDelimiter(File fileToAnalyse); String getDescription(File inputFile); String getMimetype(File inputFile);  }
@Test public void testLineSeparatorCRLF() { assertEquals("\r\n", fileAnalyser.identifyLineDelimiter(CLRF_STRICT)); }
@Test public void testLineSeparatorLF() { assertEquals("\n", fileAnalyser.identifyLineDelimiter(LF_STRICT)); }