-- Leo's gemini proxy

-- Connecting to republic.circumlunar.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Using hexdump to represent a binary file in Java source code


To embed a binary file (e.g. a png image) into Java source code:


$ hexdump -v -e '/1 "%3i, "' myfile.png
-119,  80,  78,  71,  13,  10,  26,  10,   0,   0,   0,  13,  73,  72,  68,  82, ...


Copy and paste the output into Java code like this:


private static final byte[] myfile = { (byte)-119,  80,  78,  71, ... };


Originally posted at 2014-11-05 17:03:23+00:00. Automatically generated from the original post : apologies for the errors introduced.


original post

-- Response ended

-- Page fetched on Sun May 19 03:47:34 2024