velocity-user mailing list archives

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

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);

my array in hex: magic($bytes)

Where the output is:

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.


View raw message