Writes the toString() value of each item in a collection to an OutputStream line by line, using the default character encoding of the platform and the specified line ending. @param lines the lines to write, null entries produce blank lines @param lineEnding the line s
(Collection<String> lines, String lineEnding, OutputStream output)
| 1143 | * @since Commons IO 1.1 |
| 1144 | */ |
| 1145 | public static void writeLines(Collection<String> lines, String lineEnding, OutputStream output) throws IOException { |
| 1146 | if (lines == null) { |
| 1147 | return; |
| 1148 | } |
| 1149 | if (lineEnding == null) { |
| 1150 | lineEnding = LINE_SEPARATOR; |
| 1151 | } |
| 1152 | for (Iterator<String> it = lines.iterator(); it.hasNext(); ) { |
| 1153 | Object line = it.next(); |
| 1154 | if (line != null) { |
| 1155 | output.write(line.toString().getBytes()); |
| 1156 | } |
| 1157 | output.write(lineEnding.getBytes()); |
| 1158 | } |
| 1159 | } |
| 1160 | |
| 1161 | /** |
| 1162 | * Writes the <code>toString()</code> value of each item in a collection to an |