Hi Guys,
Its a kind of strange for me.May b i am doing a blunder but i did my
best but still getting this strange behavior.I have a byte[] of an
image from  onPreviewFrame method and i am writing that image in sd
card as well sending that image from my mobile to PC through TCP.Now
on PC i always gets a whole black image but i could write a very fine
image on my sd card with that byte array unless i call close() method
of BufferedOutputStream.So can anyone of you explain me that what this
close method of BufferedOutputStream has anything to do with
FileOutputStream.


private void send(byte [] data) {
            try {
                BufferedOutputStream imagebos = new
BufferedOutputStream(client.getOutputStream());
                FileOutputStream outStream = new
FileOutputStream(String.format("sdcard/billa31.jpg",
System.currentTimeMillis()));
                outStream.write(data);
                        Log.i("Preview","send written"+data.length);
               // DatagramPacket packet = new DatagramPacket(buffer,
buffer.length, InetAddress.getByAddress(address), 5060);
                //socket.send(packet);
                //Log.d(TAG, "sent");
                        imagebos.write(data);
//                      while (flag!=1)
//                      {
//                              imagebos.write(c);
//                              outfile.write(c);
//                      }

                        outStream.flush();
                        outStream.close();
                        imagebos.flush();
//This one is culprit......when i call this,then even the image that i
am writing on my SD gets whole balck else atleast that work fine
                        imagebos.close();


                }
                catch (IOException ioe)
                {
                        ioe.printStackTrace();
                }

        }

regards
ZeeZo

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to