hi all
I am trying to send a snapshot array byte from a MIDlet to a pc. My problem is that i cannot receive the array byte completely.
my shapshot is taken using this code:
Code:byte[] image = videoCon.getSnapshot(null);
my outputstream to send the array byte looks like:
and my server has the following to receive the stream:Code:stream = (StreamConnection)Connector.open(url); OutputStream out = stream.openOutputStream(); out.write(image); out.close(); stream.close();
where bis is the bufferedinputstreamCode:ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.out.println("3:"+bis); byte b; while ((b=(byte)bis.read())!= -1){ System.out.println(b); baos.write(b); } System.out.println(b); System.out.println("writing to file"); byte[]imgByte = baos.toByteArray();
i know the code works since i have tried sending an array comprising only of strings, whatever the length, and i can receive it all.
but for the case of the array of bytes, i do not get the whole array, only a very small part of it.
my objective is taking a picture from a midlet, and sending that picture to a server and save somewhere.
if anyone got an idea of whats wrong or another way of doing this, i would be really greatful
thanks in advance
jin a

Reply With Quote

