× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2010/10/26 7:12 PM, Marvin Radding wrote:

public static byte[] toByteArray(InputStream stream)

I have defined it in RPG/ILE as

D toByteArray...
D pr 4096a
D extproc(*java
D :'org.apache.poi.util.IOUtils'
D :'toByteArray')


Besides the missing parameter that Scott mentioned, you're missing the STATIC keyword on the RPG prototype to match the static keyword for the Java method.

D toByteArray...
D pr 4096a static
D extproc(*java
D :'org.apache.poi.util.IOUtils'
D :'toByteArray')
D stream o class(*java ...)

For a non-static method, you have to pass an object "instance" of the method's class when you call the method. In Java, you would code like this to call a method on a particular object instance:
myObjInstance->toByteArray(parm);
In RPG, you code the object instance as the first parameter on the call. So you apparently pass one more parameter than is coded in the prototype.
toByteArray(myObjInstance : parm);

For a static method, the method is not instance-specific, so the RPG call requires has the same number of parameters as are coded in the prototype.

So when you didn't have either STATIC nor the parameter before, the RPG compiler expected one parameter. When you added the parameter to the prototype but not the STATIC keyword, the RPG compiler expected two parameters. If you add the STATIC keyword, the RPG compiler will again expect just one parameter.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.