public static byte [ ] toUnixLineEndings ( InputStream input ) throws IOException { String encoding = "ISO-8859-1" ; FixCrLfFilter filter = new FixCrLfFilter ( new InputStreamReader ( input , encoding ) ) ; filter . setEol ( FixCrLfFilter . CrLf . newInstance ( "unix" ) ) ; ByteArrayOutputStream filteredFile = new ByteArrayOutputStream ( ) ; Utils . copy ( new ReaderInputStream ( filter , encoding ) , filteredFile ) ; return filteredFile . toByteArray ( ) ; }
Replaces new line delimiters in the input stream with the Unix line feed .