× 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.



Joe,

You haven't shown what you tried but this worked for me:

package demo;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;


/**
 *
 * @author David Morris
 */
public class TestByteParm {
    public TestByteParm() {
        try {
            File tmpDir = new File("/tmp");
            File tempFile = File.createTempFile("stdout", "", tmpDir);
            System.setOut(new PrintStream(new
FileOutputStream(tempFile)));
        }
        catch (Throwable t) {
            System.err.println("Error overriding standard output to
file.");
            t.printStackTrace(System.err);
        }

    }
        public byte[] method(byte[] data) {
                System.out.println(data.toString());
                data[8] = 'x';
                return data;
        }
}


Dnew              PR              O   extproc(                        
D                                       *JAVA:                        
D                                       'demo.TestByteParm':          
D                                       *CONSTRUCTOR)                 
Dmethod           PR                  LIKE(val)                       
D                                     extproc(                        
D                                       *JAVA:                        
D                                       'demo.TestByteParm':          
D                                       'method')                     
D byteArray                  32767A   CONST VARYING                   
Dbefore           S               O   CLASS(*JAVA:'java.lang.string') 
DtestByteParm     S               O   CLASS(*JAVA:'demo.TestByteParm')
DVal              DS                                                  
D TstVal                        10I 0  INZ(6147)                      
D TstVal2                        5P 0  INZ(6123)                      
D TstVal3                       10A    INZ('Hello')                   
C                   EVAL      testByteParm = new()                    
C                   EVAL      Val = method(testByteParm: val)         
C                   SETON                                        LR   

When I run this I get back my original value with Hxllo.

David Morris

>>> joepluta@xxxxxxxxxxxxxxxxx 8/26/2004 9:37:17 AM >>>
> From: Joe Pluta
> 
> All I want to do is pass a data structure as a byte array.

Okay, it looks like I'll do this using a character value.  However,
I'd
still like to figure out how to pass a data structure with no
conversion.  More importantly, I'd like to pass that structure in,
modify it, and return it.

Does anybody have any ideas?

Joe

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.