Rick, It looks like you can do this with Universe UniBasic ReadBlk and we have working code. I have been unable to find any equivalent in Unidata.
Thanks, Doug www.u2logic.com On Fri, Aug 30, 2013 at 6:15 PM, Rick Nuckolls <r...@lynden.com> wrote: > Doug, > > Looking at my old code, I call a subroutine on the backend to do the > readblk, and then use the default reverse conversion on the return > argument's UniString. ( byte myBinary = myUnistring.toString().getBytes() > ).. > > UOJ, in its wisdom, does not expose the raw byte array that it gets from > the back end before it converts it to Java characters in a UniString, hence > the code above. This might even work if you use the UniSequentialFile > readBlk() function. > > Technically, it might be better to specify the character encoding, as in > byte myBinary = myUnistring.toString().getBytes("ISO-8859_1"), but this > assumes that one are sure of what UOJ used to convert the bytes received > from the server to characters, and that the conversion is 100% reversible. > It is unclear that UOJ even defines an encoding, and if Localization is in > use, UniStrings may not reverse to an equal byte array. > > Because of that uncertainty, it would be best to call a subroutine on the > UDT server that did a block read of the file, a base64 encoding of it using > ENCODE(...), and then, after passing it back to UOJ, use > sun.misc.BASE64Decoder to convert > the UniString return argument back to a byte. (After, of course, you > convert the UniString to a String.) -- For a total of 4 conversions per > source byte. > > Several years ago, I pointed out to Rocket (IBM?, Ardent?) that it might > be more appropriate for the UniSequentialFile readBlk method to return a > byte rather than a UniString. Obviously, it was too late for that, but it > does not appear that U2 has added a readBytes() method, which is no > surprise, as I recollect the conversation. (Obviously, there needs to be a > writeBlk( byte ) or writeBytes( byte ) method too.) > > Good luck, > > Rick Nuckolls > > > On Aug 30, 2013, at 2:30 PM, Doug Averch <dave...@gmail.com> wrote: > > > I was at a U2U in 2010, I think, and somebody showed us how to read and > > write files such as tiffs using UniObjects. The example was storing them > > in Unidata and send them out to the web using UOJ. > > > > Does anybody know what lecture that was? Or how to do it? > > > > Regards, > > Doug > > www.u2logic.com > > _______________________________________________ > > U2-Users mailing list > > U2-Users@listserver.u2ug.org > > http://listserver.u2ug.org/mailman/listinfo/u2-users > > _______________________________________________ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users