on 04-27-2006 9:18 PM
Hi,
I wrote a function where I get a picture (in a byte-Array). But I get a defekt Stream from the JCO.
Several time the JCO give not the result but a ?.
Here the ASCII-Code of the orig File:
ÿØÿà JFIF ` ` ÿþ Created by AccuSoft Corp. ÿÀ ° C ! ÿÛ „
ÿÄ
ÿÄ µ } !1A Qa "q 2‘¡ #B±Á RÑð$3br‚
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦[/code]
And here the result of the JCO:
ÿØÿà JFIF ` ` ÿþ Created by AccuSoft Corp. ÿÀ ° C ! ÿÛ ?
ÿÄ
ÿÄ µ } !1A Qa "q 2??¡ #B±Á RÑð$3br?
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?????????????????¢£¤¥¦[/code]
Here the code.
public byte[] getUserPicture(String arg0) throws ResourceException, IOException{
ByteArrayOutputStream out = new ByteArrayOutputStream();
if(getConnectionStatus()){
JCO.Function function = i.getFunction("HR_ESS_WHO_PROG_GET_PICTURE");
JCO.ParameterList importPara = function.getImportParameterList();
importPara.setValue(arg0, "PER_NR");
i.execute(function);
JCO.ParameterList epl = function.getTableParameterList();
JCO.Table exportData1 = epl.getTable("IMAGE_TAB");
for(int i = 0; i < exportData1.getNumRows(); i++){
exportData1.setRow(i);
byte[] bArray = exportData1.getByteArray(0);
if(bArray.length == 1023){
out.write(bArray);
byte[] temp = new byte[1];
temp[0] = 100;
out.write(temp);
}else{
out.write(bArray);
}
}
return out.toByteArray();
}
return null;
}[/code]
The size of one line is 1024.
if(bArray.length == 1023){
out.write(bArray);
byte[] temp = new byte[1];
temp[0] = 100;
out.write(temp);
}else{
out.write(bArray);
}
In the 27 row the JCO trim the length of the line to 1023 bytes. The last byte is 100.
And for this Problem I add the byte.
Regards
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thomas,
Could you comment this wizardy:
if(bArray.length == 1023){
out.write(bArray);
byte[] temp = new byte[1];
temp[0] = 100;
out.write(temp);
}else{
out.write(bArray);
}
Why you have to extend 1023 bytes to 1024 bytes (1K)???
Also, I think that the reason is that the latest row contains some noise at the end, and this causes an error. All the rest of content seems to be identical.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
GOOD
GO THROUGH THE FOLLOING LINKS,I HOPE THIS WILL HELP YOU TO SOLVE YOUR PROBLEM,
/people/tarun.telang2/blog/2005/10/01/debugging-a-rfc-call-using-jco-api
THANKS
MRUTYUN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.