[omniORB] sequences and java
lojewski
lojewski@itwm.uni-kl.de
Fri, 23 Apr 1999 15:16:58 +0100
hallo!
i want to transfer a byte stream from a server to a client. here is an
example:
typedef sequence<char> ImageData;
interface Jvcl {
ImageData getImage();
};
because the size of the image can change i use a sequence. on the java
client side i do:
char[] data = ref.getImage(); its ok !
on the server side, there is a global pointer to an image : char *image,
and a long variable l for the size of the image. the image is allocated
on the heap.
on the server-side i do this:
jvcl_i::getImage(){
ImageData *id=new ImageData();
id->length(l);
now i copy l bytes from the global image to id (is there a better way ?)
for(int i=0;i<l;i++)
(*id)[i]=image[i];
return id; now i transfer the data
}
i dont delete id , is this a memory leak ? or would id be destroyed ?
can i use the global image pointer to transfer the data directly and how
to do this ?
how can i transfer data from the stack in getImage method ?(e.g. char
c[500] is on the stack)
thanks cl.