RFR 8170769: Provide a simple hexdump facility for binary data
vincent.x.ryan at oracle.com
Thu Dec 8 11:23:38 UTC 2016
> On 8 Dec 2016, at 10:41, Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:
> I would prefer a "normal" class instead a convolut of static methods. Via a normal constructor, we could pass some custom parameters e.g. capital/uppercase letters for "abcdef", prefix a header line, width of the index counter, bytes per line, i.e. have all the parameters, you have hardcoded, variable.
The dumpToStream method is designed to cater for all forms of customisation.
You can see in the implementation that the dump method simply calls dumpToStream with a custom collector.
I think that approach is more flexible than a constructor taking a fixed set of parameters.
> Additionally I would like to see a method with variable start and end:
> String dump(byte bytes, int start, int length)
That makes sense, I will add that. And matching one for dumpToStream ?
> Am 07.12.2016 um 17:32 schrieb Vincent Ryan:
>> A hexdump facility has been available for many, many years via an unsupported class: sun.misc.HexDumpEncoder.
>> Although that class was always unsupported, it was still accessible. That accessibility changes with Jigsaw so I’m proposing
>> a very simple replacement in a new and supported class: java.util.HexDump.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8170769
>> Webrev: http://cr.openjdk.java.net/~vinnie/8170769/webrev.00/
More information about the core-libs-dev