velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Easy way to print hex rendering of byte[]
Date Fri, 13 Oct 2017 21:39:53 GMT
All,

Before I spend a whole lot of time on this, is there a dead-simple way
in VTL + stock Velocity Tools to take a byte[] reference and print-out a
hex-rendering of it? Like:

Java (roughly):
byte[] bytes = new byte[] { 0xa, 0xb, 0x12 };
ctx.put("bytes", bytes);
template.render(ctc);

VTL:
my array in hex: magic($bytes)

Where the output is:
0a0b12

What could "magic" be?

I have a static method in Java that can easily do it, so I could pop the
java.lang.Class object into the context, but I was wondering if there
was an easy way to do it without changing my Java code.


Thanks,
-chris


Mime
View raw message