public static  int reassembleSend(Object data ) throws IOException{
		
		byte[] a = new byte[1];//java.lang.String
		short len = 0;
		short rem;
		InputStream in =null;
	    if(data.getClass().isInstance(a)){
	    	
	    	len = (short) ((byte [])data).length;
	    	System.out.println("binary data, length >"+len);
	    	in = new ByteArrayInputStream((byte[]) data);
	    }
	    else if(data.getClass().isInstance("a")){
	    	len = (short) ((String) data).length();
	    	System.out.println("String data ,length >"+len);
	    	System.out.println("data "+data);
	    	in = StringToInputStream((String)data);
	    }
	    else 
	    	System.out.println("invalid data type");
	    rem = len;
	    short nsend = 0;
	    short tosend =0;
	    int off = 0;
	    byte[] buffer = null ;
	    while(rem > 0 ){
	    	
	    	if (rem >= MSS)
	    		tosend = MSS;
	    	else 
	    		tosend = rem;
	    	buffer = new byte[MSS];
	    if ((nsend = (short) in.read(buffer , 0, tosend)) < 0) {
				
	    	   
	    		 return -1;      /* error caused by send() */ 
	    	} 
			
	    	else if (nsend == 0)
	    	    break;              /* EOF */
	    	rem -= nsend;
	    	
	    	//sendData(buffer,tosend);
	        }
	    String str = new String(buffer, "UTF8");
    	System.out.println("nsend "+ nsend+"> byte: "+str);
	        return (len - rem);   
	    }