You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Damjan Jovanovic <da...@apache.org> on 2012/09/28 18:31:17 UTC
Binary file manipulation tool?
Hi
You wouldn't believe it, but one of the most invaluable testing tools
for commons-imaging I've discovered has been an x86 assembler :-).
Why? Because images are binary files which often use internal offsets
to portions of the image. An assembler lets you easily calculate and
insert offsets at compile-time. See
https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/test/data/images/bmp/4/rle8.asm
as an example.
However it makes me uncomfortable to have both images and the assembly
in my tests when the images can be generated from the assembly, or
require nasm to compile tests. Also nasm is all good for little-endian
files, but it will never support big-endian. Is there some other
binary file manipulation tool you guys know of that I can use instead,
preferably one written in Java and ideally with a Maven plugin?
Thank you
Damjan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: Binary file manipulation tool?
Posted by Jörg Schaible <jo...@gmx.de>.
Hi Damjan,
Damjan Jovanovic wrote:
> Hi
>
> You wouldn't believe it, but one of the most invaluable testing tools
> for commons-imaging I've discovered has been an x86 assembler :-).
>
> Why? Because images are binary files which often use internal offsets
> to portions of the image. An assembler lets you easily calculate and
> insert offsets at compile-time. See
>
https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/test/data/images/bmp/4/rle8.asm
> as an example.
>
> However it makes me uncomfortable to have both images and the assembly
> in my tests when the images can be generated from the assembly, or
> require nasm to compile tests. Also nasm is all good for little-endian
> files, but it will never support big-endian. Is there some other
> binary file manipulation tool you guys know of that I can use instead,
> preferably one written in Java and ideally with a Maven plugin?
Why don't you simply use a ByteBuffer? You cat set position, change byte
order on the fly and read/write all kind of primitive Data automatically.
Cheers,
Jörg
BTW: ImageInputStream and ImageOutputStream have similar capabilities.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org