[CSV][CSV-251] CSVPrinter don't handle byte[] correctly for postgres

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[CSV][CSV-251] CSVPrinter don't handle byte[] correctly for postgres

garydgregory
HI All:

Please see https://issues.apache.org/jira/browse/CSV-251.

I see the following options:

(0) Do nothing, tell users to convert byte[] to String before calling the
API. Lame but will work IMO.
(1) Convert byte[] to a String using Apache Commons Codec's Hex class by
telling it to do so through a new CSVFormat option: an enum called
ByteArrayFormat(HEXADECIMAL, BASE64). I am adding Base64 just for fun and
avoiding using a boolean.
-- (1a) Do the above and add a dependency to Commons Codec. Boom, done.
-- (1b) Do the above but rejigger Codec into a multi-module project where
PostgreSQL has its own module that depends on Commons Codec, might might
mean use of service loaders and whatnot. Might be more of a 2.0 thing and
over the top.

I favor (1a).

Thoughts?

Gary