Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

InputStream vs void pointer

843829Mar 22 2005 — edited Sep 11 2010
Hi All,

In my C program I have one void pointer. I want to send this void pointer to my Java program as InputStream. Is it possible?

Thanks,
javadevlson

Comments

JosAH
In my C program I have one void pointer. I want to send this void pointer to my
Java program as InputStream. Is it possible?
Sure it is. You need a bit of JNI stuff to pass that void* back to Java as a byte[];
given that array just use a ByteArrayInputStream.

kind regards,

Jos
843829
Do you have any C++ source code as example?

Edited by: efebo on Sep 9, 2010 5:47 PM

Edited by: efebo on Sep 9, 2010 5:54 PM
EJP
void *pointer = ...;
return (jbyte*)pointer;
efebo wrote:
Do you have any C++ source code as example?
Original (old) question makes no sense.

It is pointless to put a generic void pointer onto a stream.
If one ones to put the data that it point to on a stream then one would need to write code to do that.
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 9 2010
Added on Mar 22 2005
4 comments
227 views