Chris,
I just remembered the 'byte' type is signed in Java, so try using 'char'
instead, :
method(char buf[]) ;
Patrick
> Hello
>
> As suggested, I tried passing
>
>> my @bytes = unpack("C*", $in) ;
>> $this->method([EMAIL PROTECTED]) ;
>
> However, I get the following error
>
> [Mon Jan 19 21:17:33 2004] [error] [client 192.168.1.10] 192 out of
> range for type byte at
> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Inline/Java/Array
> .pm line 540
>
> I believe that 192 is the first part of the structure, being part of an
> IP address.
>
> Any ideas why that is happening ?
>
> Thanks
>
> Chris
>
>
>> -----Original Message-----
>> From: Patrick LeBoutillier [mailto:[EMAIL PROTECTED]
>> Sent: 18 January 2004 14:08
>> To: Chris Faulkner
>> Cc: [EMAIL PROTECTED]
>> Subject: Re: Inline Java
>>
>>
>> Chris,
>>
>> The warning you mentionned at the end has already been
>> reported and will be fixed in the next release.
>>
>> With regards to your first question, it's actually a very
>> interesting problem. Presently, Perl filehandles are not
>> automatically mapped to Java Streams.
>>
>> The only thing I can think of right now is using a byte array:
>>
>> method(byte buf[]) ;
>>
>> and using unpack to create a Perl list:
>>
>> my @bytes = unpack("C*", $in) ;
>> $this->method([EMAIL PROTECTED]) ;
>>
>> This is pretty inefficient but I think it should work.
>>
>> I'll keep thinking about it, and let me know if you find
>> anything or if this works for you.
>>
>> Patrick
>>
>>
>> > Hello
>> >
>> > I have a perl cgi script that reads some binary data from STDIN. It
>> > does it like this:
>> >
>> > binmode STDIN;
>> > read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
>> >
>> > I have some Inline Java code a couple of methiclass. I
>> would like to
>> > pass that binary data ($in) to a Java method. How is this
>> done ? DO I
>> > need some kind of InputStream ? I have tried this, as well as
>> > DataInputStream
>> >
>> > method (java.io.InputStream is )
>> >
>> > but in my error log I see a message "Can't convert" which is not a
>> > message anywhere in my class. I know that there is data in
>> $in because
>> > I have written out out to a binary file.
>> >
>> > How can I pass the data ?
>> >
>> > One other small thing, when I run with perl -w, I see this:
>> >
>> > [Sat Jan 17 23:54:46 2004] [error] [client 192.168.1.10]
>> v-string in
>> > use/require non-portable at
>> >
>> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Inline/Java.pm
>> > line 9.
>> >
>> > Line 9 simply is an import of java.util.Date
>> >
>> > use Inline Java => <<'END_OF_JAVA_CODE',DIRECTORY =>
>> '/tmp/Inline' ;
>> > import java.io.*; import java.util.*;
>> > import java.util.Date;
>> > import java.text.*;
>> >
>> > Thanks
>> >
>> >
>> > Chris
>> >
>> >
>> >
>>
>>
>
>
>
>