-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper methods to CsvOutput to bridge writing CSV Files and Iterators #1984
Conversation
… existing CsvFile and CsvIterator instances.
* @param alwaysQuote when true, each column will be quoted, when false, quoting is selective | ||
* @throws UncheckedIOException if an IO exception occurs | ||
*/ | ||
public void writeRows(Iterable<? extends CsvRow> rows, boolean alwaysQuote) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Method should be next to
writeRow
(afterwriteLine
) CsvRow
is final, so? extends
won't add much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep writeLine_s_ and writeRow_s_ next to each other?
* @param file the file whose contents to output | ||
* @param underlying the destination to write to | ||
*/ | ||
public static void writeStandard(CsvFile file, Appendable underlying) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instance methods would be the better choice, as 12 methods should reduce to 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an 'alwaysQuote' param to each (for consistency) and make that four?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, ignore that, safe/standard is already on the instance, isn't it.
@@ -222,6 +222,22 @@ public void writeLines(Iterable<? extends List<String>> lines, boolean alwaysQuo | |||
} | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move method below lines methods. ie. group all the lines methods, then all the rows methods, then all the cell methods, then the file/iterator ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sometimes you already have an instance of a CsvFile or CsvIterator that you want to write out somewhere. This PR adds some static helper methods to CsvOutput to help support that.