Jason, I see what's going on. The problem is that a byte in Perl has range 0-255, but a byte in Java has range -128-127. That's why Inline::Java is telling you that the values you are passing are out of range.
Inline::Java should probably do this kind of conversion automatically for you, but for now it doesn't do it. Try applying this patch your x.pl, I think it will work. ###################################### 22c22 < my @bytes = map { ord($_) } split('',$val1); --- > my @bytes = map { (unpack('c', $_))[0] } split('',$val1); 27c27 < my $val2 = join('',map {chr($_)} @bytes),"\n"; --- > my $val2 = join('',map {pack('c', $_)} @bytes); 37c37 < print join('',map {chr($_)} @java_bytes),"\n"; --- > print join('',map {pack('c', $_)} @java_bytes),"\n"; On 9/22/05, Jason Stelzer <[EMAIL PROTECTED]> wrote: > > On Sep 22, 2005, at 8:40 PM, Patrick LeBoutillier wrote: > > > Jason, > > > > Have you tried something like this: > > > > I have. I've attached some very similar code that I've tried just to > get things working. I agree that splitting a (potentially large) > string into bytes is expensive, but if that works I'll find a way to > deal with it. I've tried enabling debugging to see whats going on. > I'll continue down that path. The core of the problem is that the > array isn't being treated as bytes. > > The reason I thought I'd need to cast or coerce the data is because I > get this message at runtime: > > > In method write of class main::java::io::ByteArrayOutputStream: Can't > find any signature that matches the arguments passed (ARRAY > (0x82159ec), 0, 255). > Available signatures are: > write(int) > error was: Wrong number of arguments at /home/ > jstelzer/projects/datapump/dp_build/hms/datapump/ext/lib/perl5/ > site_perl/5.8.6/i686-linux/Inline/Java/Object.pm line 101 > write([B, int, int) > error was: 128 out of range for type byte at /home/ > jstelzer/projects/datapump/dp_build/hms/datapump/ext/lib/perl5/ > site_perl/5.8.6/i686-linux/Inline/Java/Array.pm line 540 > write([B) > error was: Wrong number of arguments at /home/ > jstelzer/projects/datapump/dp_build/hms/datapump/ext/lib/perl5/ > site_perl/5.8.6/i686-linux/Inline/Java/Object.pm line 101 at x.pl > line 31 > > > > > > > -- ===================== Patrick LeBoutillier Laval, Québec, Canada