aliocrlib/src/main/java/com/lib/aliocr/utils/io/IOUtils.java
/**
     * Writes the <code>toString()</code> value of each item in a collection to
     * an <code>OutputStream</code> line by line, using the specified character
     * encoding and the specified line ending.
     *
     * @param lines      the lines to write, null entries produce blank lines
     * @param lineEnding the line separator to use, null is system default
     * @param output     the <code>OutputStream</code> to write to, not null, not closed
     * @param encoding   the encoding to use, null means platform default
     * @throws NullPointerException if the output is null
     * @throws IOException          if an I/O error occurs
     * @since 2.3
     */
Writes the toString() value of each item in a collection to
an OutputStream line by line, using the specified character
encoding and the specified line ending.


Writes the toString () value of each item in a collection to an OutputStream line by line using the specified character encoding and the specified line ending .
public static void writeLines(Collection<?> lines, String lineEnding, OutputStream output, Charset encoding)
            throws IOException {
        if (lines == null) {
            return;
        }
        if (lineEnding == null) {
            lineEnding = LINE_SEPARATOR;
        }
        Charset cs = Charsets.toCharset(encoding);
        for (Object line : lines) {
            if (line != null) {
                output.write(StringCodingUtils.getBytes(line.toString(), cs));
            }
            output.write(StringCodingUtils.getBytes(lineEnding, cs));
        }
    }
public static void writeLines ( Collection < ? > lines , String lineEnding , OutputStream output , Charset encoding ) throws IOException { if ( lines == null ) { return ; } if ( lineEnding == null ) { lineEnding = LINE_SEPARATOR ; } Charset cs = Charsets . toCharset ( encoding ) ; for ( Object line : lines ) { if ( line != null ) { output . write ( StringCodingUtils . getBytes ( line . toString ( ) , cs ) ) ; } output . write ( StringCodingUtils . getBytes ( lineEnding , cs ) ) ; } }
Writes the <code>toString()</code> value of each item in a collection to
 an <code>OutputStream</code> line by line, using the specified character
 encoding and the specified line ending.
Writes the <code > toString () < / code > value of each item in a collection to an <code > OutputStream< / code > line by line using the specified character encoding and the specified line ending .