Witam!

Chciałem przesłać sobie zawartość sms inbox na PC.
Rozwiązane jest dokopanie się do danych na androidze, organizacja w struktury i NIBY wysyłanie. Niestety po drugiej stronie a więc na PC otrzymuje błędy typu invalid header:04. Nie mam pojęcia dlaczego tak się dzieje. Do przesyłu wykorzystuje pewne metody(podam je ponizej) przy użyciu których przesyłam np nazwe telefonu, zawartość książki telefonicznej (razem ze zdjęciami) i to działa. Zauważyłem również, że jeżeli próbuję przesłać każdego sms osobno - działa bez problemu tylko trwa ROK ALBO 2.
Dlatego też chce utworzyć sobie ArrayList zawierający wszystkie sms i przesłać ten jeden obiekt - w tym przypadku wszystko się kraszuje - (po stronie juz pc) malformed header itd itp :( Dlaczego?

PS. SmsEntry które będzie gdzieś poniżej to zwykła klasa zawierająca tylko pola typu int i string oraz gettery i settery do nich.
klasy TransmissionHandler oraz SmsEntry są we wspólnej bibliotece wykorzystywanej zarówno przez pc i androida.

Pobranie i wysłanie listy z wiadomościami sms

    private void SendSmsList() throws IOException {
        {
            Log.d("SendMe sms", "Reading and sending sms list");
            Uri allMessages = Uri.parse("content://sms/");
            //Cursor cursor = managedQuery(allMessages, null, null, null, null); Both are same
            String[] project = new String[]
            {
                "_id",
                "thread_id", "person", "date", "read", "status", "type", "body"
            };
            Cursor cursor = currentService.getContentResolver().query(allMessages, project,
                    null, null, null);
            SmsEntry sms = new SmsEntry();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            int i=0;
            ArrayList<SmsEntry> array=new ArrayList<SmsEntry>(1000);
                while (cursor.moveToNext() && ++i<2000)
                {
                    sms = new SmsEntry();
                    sms.setMessageId(cursor.getInt(0));
                    sms.setThreadId(cursor.getInt(1));
                    sms.setPersonId(cursor.getInt(2));
                    sms.setDate(cursor.getLong(3));
                    sms.setRead(cursor.getInt(4));
                    sms.setStatus(cursor.getInt(5));
                    sms.setType(cursor.getInt(6));
                    sms.setMessage(cursor.getString(7));
                    sms.setDstNumber("NAN");
                    array.add(sms);
                    

                }
                oos.writeObject(array);
                oos.flush();
                baos.close();
                Log.d("SendMe sms", "Size "+baos.size());
                SendData(baos.toByteArray());
}

    private void SendData(byte[] data) throws IOException {
        try
        {
            th.SendDataSize(data.length);
            th.SendData(data);
        }
        catch (IOException ex)
        {
            Logger.getLogger(DataProvider.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

(th) transmision handler SendData i ReceiveData

    public boolean SendData(byte[] data) throws IOException {
        if (ReceiveCommand().equals(DataTransferTag.DATA_ACK)) {
            SendCommand(DataTransferTag.DATA_ACK);
            output.write(data);
            output.flush();
            return false;
        } else {
            return true;
        }
    }

    public ByteBuffer ReceiveData() throws IOException {
        /*       long size=ReceiveDataSize();
        ByteBuffer ret;      
        SendCommand(DataTransferTag.DATA_ACK);
        if (ReceiveCommand().equals(DataTransferTag.DATA_ACK)) { // wait for readyness of sockt endpoint
        dataBuffer.clear();          
        input.read(dataBuffer.array(), 0, (int) size);
        ret=ByteBuffer.allocate((int) size).put(dataBuffer.array(),0,(int)size);
        ret.clear();
        
        
        return ret;
        } else {
        return null;
        }*/

        long size = ReceiveDataSize();
        long chunk = 0;
        long parts=0;
        int length=this.notifySize;
        byte[] buff = new byte[this.notifySize];
        DataTransferEvent e=new DataTransferEvent(0,size);
        SendCommand(DataTransferTag.DATA_ACK);
        if (ReceiveCommand().equals(DataTransferTag.DATA_ACK)) {
            dataBuffer.clear();
            while (chunk<size) 
            {
                if((size-chunk)<length) length=(int) (size-chunk);
                chunk+=input.read(buff, 0, length);
                dataBuffer.put(buff);
                e.chunkSize=chunk;
                this.notifyRecveiveListeners(e);
            }
            
            return ByteBuffer.allocate((int) size).put(dataBuffer.array(),0,(int)size);
        }
        return null;
    }

Odbiór po stronie PC

 public void RefreshMessagesList() {
        Thread t = new Thread(new Runnable() {

            @Override
            public void run() {
                try
                {
                    mf.setStatus("Requesting Sms/Mms entries ...");
                    final TransmissionHandler th = ConnectionManager.getInstance().th;
                    MessagePanel mp = mf.getMessagePanel();
                    mp.clearList();
                    messages.clear();
                    int mark = 0;
                    int dataSize = 0;
                    boolean cons = true;
                    th.SendCommand(DataTransferTag.REQUEST_SMS_LIST);
                    //   while (cons) {
                    mf.setStatus("Receiving...(" + (mark++) + ")");
                    ByteArrayInputStream bais = new ByteArrayInputStream(th.ReceiveData().array());
                    ObjectInputStream ois = new ObjectInputStream(bais);
                    mf.setStatus("Parsuje...");
                    //     while (ois.available() > 0)
                    Object o=ois.readObject();    // TUTAJ WYSYPUJE WYJĄTKIEM O NIEPOPRAWNYM HEADERZE STREAMU 
                    messages=(ArrayList<SmsEntry>) o;
                    
                    for(SmsEntry sms:messages)
                        mp.AddEntry(sms);
                    mf.setStatus("Done");


                }
                catch (ClassNotFoundException ex)
                {
                    Logger.getLogger(SmsManager.class.getName()).log(Level.SEVERE, null, ex);
                }
                catch (IOException ex)
                {
                    Logger.getLogger(SmsManager.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        t.setName("SmsRetrieval");
        t.setPriority(5);
        t.setDaemon(true);
        t.start();
    }