[tcljava-user] Getting the data back from ByteArrayOutputStream.toByteArray
Brought to you by:
mdejong
From: BEASLEY, J. S <SBE...@sc...> - 2008-06-04 22:08:56
|
Hello, I am using a ByteArrayOutputStream object to read PDF data into, from a call to the iText library. Everything is working out with tcl/Java and the library except this.... I perform a toByteArray on my ByteArrayOutputStream object, and it Creates a newly allocated byte array. I do something like: set j_byteArray [$memory_stream toByteArray] ; # memory_stream is my ByteArrayOutputStream object This returns a good object handle from Blend. How do I get the Byte Array Data from the Java object to a locale tcl variable in my code? I can get it as a String like: set pdf_data [$memory_stream toString] but the binary data in the pdf gets clobbered on the encoding conversion (I assume). As of now, I have it working by Hex encoding the result of [$memory_stream toByteArray] in some Java code and calling and doing a [binary format] on the tcl side. I would like a more direct way and save some processing time if I could. Thanks |