Hi,
I have a problem with the variable type byte. At the moment, I have to use an existing Java class which recieves a byte array for its argument and will also return a byte array (byte[]).. But for testing, i hardcoded the Java method to return the array {89,65,80} (Basically making the word "YAP")
When i use StrConv on the returning argument, i cannot get back the word "YAP". Here's a snippet of my code.
dim from() as byte
dim result(0 to 2) as byte
dim m as string
'== The java object named crypt ==
Set test = GetObject("java:cryp")
'== Wrote the returning argument into a binary file ==
Open "f:\tempp.x" For Binary Access Write As #3
Put #3, 1, test.ByteIn(result(0))
Close #3
'== Read back binary file into from array ==
dum = FreeFile
Open "f:\tempp.x" For Binary Access Read As #dum
Get #dum, 1, from
Close #dum
'== converting back into readable string ==
m = StrConv(from, vbUnicode)
msgbox m
Is there something missing?
What i got back was sorta wierd text. Something like when you have the wrong encoding method with boxes and stuff.
Hope somebody can help me. Or at least tell me if it is possible to pass a byte array into a java class and get back a compatible byte array.
I have a problem with the variable type byte. At the moment, I have to use an existing Java class which recieves a byte array for its argument and will also return a byte array (byte[]).. But for testing, i hardcoded the Java method to return the array {89,65,80} (Basically making the word "YAP")
When i use StrConv on the returning argument, i cannot get back the word "YAP". Here's a snippet of my code.
dim from() as byte
dim result(0 to 2) as byte
dim m as string
'== The java object named crypt ==
Set test = GetObject("java:cryp")
'== Wrote the returning argument into a binary file ==
Open "f:\tempp.x" For Binary Access Write As #3
Put #3, 1, test.ByteIn(result(0))
Close #3
'== Read back binary file into from array ==
dum = FreeFile
Open "f:\tempp.x" For Binary Access Read As #dum
Get #dum, 1, from
Close #dum
'== converting back into readable string ==
m = StrConv(from, vbUnicode)
msgbox m
Is there something missing?
What i got back was sorta wierd text. Something like when you have the wrong encoding method with boxes and stuff.
Hope somebody can help me. Or at least tell me if it is possible to pass a byte array into a java class and get back a compatible byte array.