[armedbear-devel] is there a good method to read/write java byte arrays?

Mark Evenson evenson at panix.com
Wed Mar 17 16:22:28 UTC 2010


On 3/17/10 5:04 PM, Alessio Stalla wrote:
[…]

> I wrote sys::%make-byte-array-output-stream in order to make the
> runtime compiler capable of generating bytecode without using
> temporary files; it wasn't meant to be used by the ABCL user, and as
> such it's not very polished (for example, the type of a
> byte-array-output-stream is simply STREAM). In any case, it's defined
> in the ByteArrayOutputStream Java class, and as you correctly noted,
> it explicitly sets the element type to (unsigned-byte 8). As a quick
> and dirty solution, you could more or less copy-paste that class and
> replace "output" with "input" :) (as well as update Autoload.java to
> make ABCL know of the new primitives).
>
> We should probably polish it a bit and release it as an extension.

Well, at least we should quickly  whip out the inverse version so David 
doesn't have to rely on hacking Stream.java (although I'm not sure when 
telling Stream that initAsBinaryStream() means a format of unsigned 8bit 
bytes will fail).

I think we can commit to the interface you've implemented in 
ByteArrayOutputStream, as those are the basic necessary operations.

Or maybe I am not seeing what potential problems there would be with 
this as a short-term strategy, Alessio?

-- 
"A screaming comes across the sky.  It has happened before, but there
is nothing to compare to it now."




More information about the armedbear-devel mailing list