Just some Subrutines.


/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package midletehs8sms; import java.util.Vector; public class Subrutine { //--------------------------------------------------------- MidletEHS8SMS parent; NetworkRegistration nwr; Subrutine sub; String_Manipulation sm; //--------------------------------------------------------- public boolean exception = false; public boolean exception_bool = false; public boolean exception_in_query_ok = false; public boolean message_read_OK = false; public boolean deleted_message_ok = false; //--------------------------------------------------------- //AT+CSDH Show SMS text mode parameters public int CSDH = 0; //--------------------------------------------------------- //ATV Result code format mode public String Result_code_format_mode = null;//0 or 1 public String response = null; public String get_the_response_code_as_a_string = null; public String get_the_response_code = null; //--------------------------------------------------------- public String phonenumber = null; public String string_date = null; public String string_time_stamp = null; public String text_message = null; public String[] arr = new String[128]; public String message_read = null; public String [] extract_values = null; public String [] array = null; //--------------------------------------------------------- public String header = null; public String substring_read = null; public String[] splitted_header; public String[] sms_array_read; public String message = null; //--------------------------------------------------------- public int sms_position_in_memory = 0; //String [][] memory = null; //--------------------------------------------------------- public String memory_storage_1 = null; public int memory_1_available = 0; public int memory_1_in_use = 0; //--------------------------------------------------------- public String memory_storage_2 = null; public int memory_2_available = 0; public int memory_2_in_use = 0; //--------------------------------------------------------- public String memory_storage_3 = null; public int memory_3_available; public int memory_3_in_use; public String [] string_array = new String[0]; /*****************************************************************************/ public String string_memory_1_available = null; public String string_memory_1_in_use = null; public String string_memory_2_available = null; public String string_memory_2_in_use = null; public String string_memory_3_available = null; public String string_memory_3_in_use = null; /*****************************************************************************/ public void Subrutine( MidletEHS8SMS parent ,String_Manipulation sm ) { //--------------------------------------------------------- this.parent = parent; this.sm = sm; //--------------------------------------------------------- /*---------------------------------------------------------------------------*/ } /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /* ========================================================================= */ /*****************************************************************************/ // From here on go's all the Subroutine */ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** DeleteAllMessage ************************************/ /*****************************************************************************/ public void DeleteAllMessage() { System.out.println("DeleteAllMessage begin"); boolean deleted_ok = false; String atcmdresponse = null; int i = 0; //----------------------------------------------------------------------------- if(parent.atcommand != null && parent.registered){ //----------------------------------------------------------------------------- try{ atcmdresponse = parent.SendCommand("AT+CMGD=1,4 \r"); } catch (Exception aa) { System.out.println("Exception in DeleteAllMessage ! -> " + aa ); } //----------------------------------------------------------------------------- }//if.. //----------------------------------------------------------------------------- System.out.println("DeleteAllMessage end"); /*---------------------------------------------------------------------------*/ }//DeleteAllMessage() /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Send_SMS *****************************************/ /*****************************************************************************/ public boolean Send_SMS(String text_sms, String phone_number) { /*---------------------------------------------------------------------------*/ //============================================================================= int loop = 10; parent.registered = false; //--------------------------------------------------------- while(loop>0){ parent.registered = parent.nwr.GetShortNetworkRegistration(); if(parent.registered){ break; }else{ try{parent.Delay(5000);}catch(Exception in){} loop--; } //--------------------------------------------------------- }//while //--------------------------------------------------------- if(!parent.registered){ System.out.println("** HTTP_Ping No Network **"); System.out.println("** HTTP_Ping Return Unresolved. **"); System.out.println("** HTTP_Ping End **"); return false; } //============================================================================= //============================================================================= try { //----------------------------------------------------------------------------- //activate the SMS URCs System.out.println(parent.SendCommand("at+cnmi=2,1\r")); // switch to the text mode parent.atcmdresponse = parent.SendCommand("AT+CMGF=1\r"); System.out.println("Set TEXT-mode: " + parent.atcmdresponse); // provide the receiver number parent.atcmdresponse = parent.SendCommand("AT+CMGS=\"" + phone_number + "\"\r"); System.out.println("Set telephone number: " + parent.atcmdresponse); // provide the message text & confirm (terminate) parent.atcmdresponse = parent.SendCommand(text_sms.trim() + (char) 26); /* ------------------------------------------------------------------------- */ // CTRL-Z = 0x1A (hex) or 26 (dec) /* ------------------------------------------------------------------------- */ System.out.println("Response: " + parent.atcmdresponse ); //----------------------------------------------------------------------------- } catch (Exception aa) { System.out.println("Exception in Send_Back ! -> " + aa ); return false; } //----------------------------------------------------------------------------- /*---------------------------------------------------------------------------*/ return true; //----------------------------------------------------------------------------- /*---------------------------------------------------------------------------*/ } //Send_sms end's here /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* /* /* /* /* /* /* /* /*****************************************************************************/ /*********************** Send_Back *******************************************/ /*****************************************************************************/ public boolean Send_Back(String text_sms, String phone_number) { /*---------------------------------------------------------------------------*/ //============================================================================= int loop = 10; parent.registered = false; //--------------------------------------------------------- while(loop>0){ parent.registered = parent.nwr.GetShortNetworkRegistration(); if(parent.registered){ break; }else{ try{parent.Delay(5000);}catch(Exception in){} loop--; } //--------------------------------------------------------- }//while //--------------------------------------------------------- if(!parent.registered){ System.out.println("** HTTP_Ping No Network **"); System.out.println("** HTTP_Ping Return Unresolved. **"); System.out.println("** HTTP_Ping End **"); return false; } //============================================================================= if( isValidPhoneNumber(phone_number) && text_sms != null && text_sms.length() > 0 && parent.atcommand != null && parent.registered ) //----------------------------------------------------------------------------- { /*---------------------------------------------------------------------------*/ try { //----------------------------------------------------------------------------- // switch to the text mode String atcmdresponse = parent.SendCommand("AT+CMGF=1\r"); System.out.println("Set TEXT-mode: " + atcmdresponse); // provide the receiver number atcmdresponse = parent.SendCommand("AT+CMGS=\"" + phone_number + "\"\r"); System.out.println("Set telephone number: " + atcmdresponse); // provide the message text & confirm (terminate) atcmdresponse = parent.SendCommand(text_sms + (char) 26); /* ------------------------------------------------------------------------- */ // CTRL-Z = 0x1A (hex) or 26 (dec) /* ------------------------------------------------------------------------- */ // show the response on the screen boolean boolean_response = Query_OK(atcmdresponse); System.out.println("Response sending the message: " + boolean_response); if(boolean_response){ System.out.println("Message sent!"); return true; } else{ System.out.println("Could not send text Message back!"); return false; } //----------------------------------------------------------------------------- } catch (Exception aa) { System.out.println("Exception in Send_Back ! -> " + aa ); return false; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- } //isValidPhoneNumber /*---------------------------------------------------------------------------*/ return true; } //SendBack end's here /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** isValidPhoneNumber **********************************/ /*****************************************************************************/ /** * Check the phone number for validity * Valid phone numbers contain only the digits 0 thru 9, and may contain * a leading '+'. */ //----------------------------------------------------------------------------- public boolean isValidPhoneNumber(String number) { number = number.trim(); char[] chars = number.toCharArray(); if (chars.length == 0) { return false; } int startPos = 0; // initial '+' is OK if (chars[0] == '+') { startPos = 1; } for (int ii = startPos; ii < chars.length; ++ii) { if (!Character.isDigit(chars[ii])) { return false; } }//for... return true; } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Extract_Values **************************************/ /*****************************************************************************/ public String[] Extract_Values(char delimiter, String queryed){ // System.out.println("Extract_Values(Begin)" ); String [] q_array = new String[128]; //----------------------------------------------------------------------------- queryed = sm.Get_Substring(':', queryed); queryed = queryed.toString().trim(); //----------------------------------------------------------------------------- if( queryed.length() > 0 ){ //----------------------------------------------------------------------------- // System.out.println("Calling string split" ); q_array = sm.Split_String_Into_Array(delimiter , queryed); //----------------------------------------------------------------------------- for(int i = 0; i < q_array.length; i++){ // String s = q_array[i].toString().trim() ; // q_array[i].toString().trim() ; q_array[i] = q_array[i].toString().trim() ; // q_array[i] = s; // System.out.println("Extracted Values: " + q_array[i]); } //----------------------------------------------------------------------------- }//if... //----------------------------------------------------------------------------- // System.out.println("Extract_Values(End)" ); return q_array; } /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Query_OK ********************************************/ /*****************************************************************************/ // Query_OK() test the result code for either "0" (ATV0) or "OK" (ATV1) /*****************************************************************************/ public boolean Query_OK(String queryed) { // System.out.println("Query_OK (BEGIN)"); String [] q_array; boolean boolean_query = false; exception_in_query_ok = false; // int i; String local = null; String [] local_arry = new String [256]; /*---------------------------------------------------------------------------*/ // System.out.println("Query_OK BEGIN \nQueryed string = " + queryed); // AT&V responses -> //------------------------------------- // ACTIVE PROFILE: // E1 Q0 V0 X4 &C1 &D2 &S0 \Q0 \V1 // S0:000 S3:013 S4:010 S5:008 S6:000 S7:060 S8:000 S10:002 // +CBST: 7,0,1 // +CRLP: 61,61,78,6 // +CR: 0 // +CRC: 0 // +CMGF: 0 // +CNMI: 1,0,0,0,0 // +CMEE: 0 // +ICF: 3 // +DTMF: 0 // +CSMS: 0,1,1,1 // +CREG: 0,1 // +CLIP: 0,2 // +COPS: 0,0,"3 DK",2 // +CGSMS: 1 // // OK //------------------------------------- /*---------------------------------------------------------------------------*/ try{ parent.SendCommand("at+cnmi=2,1\r"); parent.SendCommand("ATV1\r"); parent.SendCommand("AT&W\r"); local = parent.SendCommand("AT&V\r"); // System.out.println("AT&V = " + local); local_arry = Extract_Values( '\r',local); String temp = local_arry[0].toString(); // System.out.println("local_arry[0] = " + temp); local_arry = Extract_Values(' ', temp); /*---------------------------------------------------------------------------*/ // Result code format mode: V0 or V1 // The string Result_code_format_mode is only used here in Query_OK(String result_code) // Query_OK() test the result code for either "0" (ATV0) or "OK" (ATV1) /*---------------------------------------------------------------------------*/ Result_code_format_mode = local_arry[2].trim(); // System.out.println("Result_code_format_mode in Query_OK(AT&V) = " + Result_code_format_mode); } catch (Exception ee) { exception_in_query_ok = true; System.out.println("Exception in Query_OK(AT&V) " + ee); return false; } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* for(int i=0; i < local_arry.length ; i++){ // System.out.println(""); System.out.println("Query_OK Arrays[" + i + "] = " + local_arry[i] ); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* for(int i=0; i < local_arry.length ; i++){ // System.out.println(""); System.out.println("Query_OK Arrays[" + i + "] = " + local_arry[i] ); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ try{ //----------------------------------------------------------------------------- // Get rid of <CR>'s if( queryed.length() > 0 ){ q_array = sm.Split_String_Into_Array('\r' , queryed.trim()); //----------------------------------------------------------------------------- for( int i = q_array.length - 1; i >= 0; i--){ //----------------------------------------------------------------------------- if((Result_code_format_mode.indexOf("V0") != -1) && (0 == (Integer.parseInt(String.valueOf(q_array[i].trim()) ) ) ) ) { boolean_query = true; break; }else //----------------------------------------------------------------------------- // if(("V1".trim().equals(Result_code_format_mode.toString().trim()) ) if((Result_code_format_mode.indexOf("V1") != -1) && ("OK".indexOf(q_array[i]) != -1) ) { boolean_query = true; break; } //----------------------------------------------------------------------------- // System.out.println("Q_Arrays[" + i + "] = " + q_array[i] ); }//for... //----------------------------------------------------------------------------- }//if... //----------------------------------------------------------------------------- }catch(NumberFormatException e){ System.out.println("Exception in Query_OK " + e); exception_in_query_ok = true; exception_bool = true; } /*---------------------------------------------------------------------------*/ // System.out.println("Query_OK (END)"); return boolean_query; } /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** List_SMS_Memory_Storage *****************************/ /*****************************************************************************/ public boolean List_SMS_Memory_Storage(){ // public String [][] List_SMS_Memory_Storage(){ //----------------------------------------------------------------------------- // System.out.println("***** List_SMS_Memory_Storage (BEGIN) *****"); //----------------------------------------------------------------------------- String [][] memory = new String[4][4]; // String [] array_1, array_2, array_3; string_array = new String[0]; String get_substring; // int index, len; // System.out.println(""); memory_1_available = 0; memory_1_in_use = 0; memory_2_available = 0; memory_2_in_use = 0; memory_3_available = 0; memory_3_in_use = 0; string_memory_1_available = null; string_memory_1_in_use = null; string_memory_2_available = null; string_memory_2_in_use = null; string_memory_3_available = null; string_memory_3_in_use = null; //----------------------------------------------------------------------------- // //============================================================================= // Only for TC65: // get_the_response_code_as_a_string = parent.atcommand.send("AT^SLMS\r"); //----------------------------------------------------------------------------- // AT^SLMS // Response(s) // ^SLMS: ''MT'',<total3>, <used3> // ^SLMS: ''SM'',<total1>, <used1> // ^SLMS: ''ME'',<total2>, <used2> // OK //----------------------------------------------------------------------------- // AT^SLMS List SMS Memory Storage -> // ^SLMS: "MT",30,5 // ^SLMS: "SM",5,5 // ^SLMS: "ME",25,0 // 0 or OK //----------------------------------------------------------------------------- // For TC65: // AT+CPMS Preferred SMS message storage // AT+CPMS? // +CPMS: "ME",0,25,"SM",5,5,"MT",5,30 //============================================================================= // For EHS8: // AT+CPMS? // +CPMS: <mem1>, <used1>, <total1>, // <mem2>, <used2>, <total2>, // <mem3>, <used3>, <total3> // OK // AT+CPMS? // +CPMS: "SM",32,50,"SM",32,50,"SM",32,50 //============================================================================= // System.out.println(""); try{ get_the_response_code_as_a_string = parent.SendCommand("AT+CPMS?\r"); // System.out.println(get_the_response_code_as_a_string); //------------------------------------- // Result: // AT+CPMS? // +CPMS: "SM",0,50,"SM",0,50,"SM",0,50 // // OK //------------------------------------- string_array = sm.Split_String_Into_Array('\r' , get_the_response_code_as_a_string); /* ------------------------------------------------------------------------- */ /* for(int ar =0; ar < string_array.length; ar++){ System.out.println("string_array["+ar+"] = " + string_array[ar]); } /* ------------------------------------------------------------------------- */ // string_array[0] = AT+CPMS? // string_array[1] = // string_array[2] = +CPMS: "SM",0,50,"SM",0,50,"SM",0,50 // string_array[3] = // string_array[4] = // OK // No indexOf("+CPMS:") //----------------------------------------------------------------------------- // System.out.println(""); String result = null; //----------------------------------------------------------------------------- try{ for(int i = 0; i < string_array.length; i++){ if(string_array[i].indexOf("+CPMS:") != -1){ result = string_array[i]; break;} if(i == (string_array.length -1) ){ // System.out.println("No break"); return false; } } } catch (Exception m) { System.out.println("Exception in breaking up: " + m);} //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if(result != null && result.indexOf("+CPMS:") != -1){ // System.out.println("Result = " +result); // Result: +CPMS: "SM",0,50,"SM",0,50,"SM",0,50 }else{ // System.out.println("No indexOf(\"+CPMS:\")"); return false; } //----------------------------------------------------------------------------- String substring = sm.Get_Substring(':', result); // System.out.println("Result = " +result); // Result: "SM",32,50,"SM",32,50,"SM",32,50 result = sm.GetRidOfSomeChar('"', substring); // System.out.println("Result = " +result); // Result: SM,32,50,SM,32,50,SM,32,50 // System.out.println("**** Split The String Into An Array Begin ****"); string_array = String_Manipulation.Split_String_Into_Array("," , result); // System.out.println("**** Split The String Into An Array End ****"); //----------------------------------------------------------------------------- // array = new String[0]; // string_array = Append_Array(array, string_array); //----------------------------------------------------------------------------- } catch (Exception m) { System.out.println("Exception in Append_Array in List_SMS_Memory_Storage:\n" + m); return false; } /* ========================================================================= */ //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* ------------------------------------------------------------------------- */ /* try{ for(int i = 0; i < string_array.length; i++){ System.out.println("Memory["+i+"] = " + string_array[i]);} } catch (Exception m) {System.out.println("Exception in Memory[]\n" + m);} /* ------------------------------------------------------------------------- */ //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Result:run: // Memory[0] = "SM" // Memory[1] = 32 // Memory[2] = 50 // Memory[3] = "SM" // Memory[4] = 32 // Memory[5] = 50 // Memory[6] = "SM" // Memory[7] = 32 // Memory[8] = 50 /* ========================================================================= */ /*---------------------------------------------------------------------------*/ try{ //--------------------------------------------------------- string_memory_1_available = String.valueOf(string_array[2].trim()); string_memory_1_in_use = String.valueOf(string_array[1].trim()); //--------------------------------------------------------- memory_storage_1 = string_array[0]; memory_1_in_use = (int) Integer.parseInt(string_memory_1_in_use); memory_1_available = (int) Integer.parseInt(string_memory_1_available); //--------------------------------------------------------- } catch (NumberFormatException m) { System.out.println("Exception in Integer.parseInt[1]\n" + m); return false; } //--------------------------------------------------------- try{ //--------------------------------------------------------- string_memory_2_available = String.valueOf(string_array[5].trim()); string_memory_2_in_use = String.valueOf(string_array[4].trim()); //--------------------------------------------------------- memory_storage_2 = string_array[3]; memory_2_in_use = (int) Integer.parseInt(string_memory_2_in_use); memory_2_available = (int) Integer.parseInt(string_memory_2_available); //--------------------------------------------------------- } catch (NumberFormatException m) { System.out.println("Exception in Integer.parseInt[2]\n" + m); return false; } //--------------------------------------------------------- try{ //--------------------------------------------------------- string_memory_3_available = String.valueOf(string_array[8].trim()); string_memory_3_in_use = String.valueOf(string_array[7].trim()); //--------------------------------------------------------- memory_storage_3 = string_array[6].trim(); memory_3_in_use = (int) Integer.parseInt(string_memory_3_in_use); memory_3_available = (int) Integer.parseInt(string_memory_3_available); //--------------------------------------------------------- } catch (NumberFormatException m) { System.out.println("Exception in Integer.parseInt[3]\n" + m); return false; } /*---------------------------------------------------------------------------*/ /* ========================================================================= */ // System.out.println(""); //----------------------------------------------------------------------------- // System.out.println("***** List_SMS_Memory_Storage (END) *****"); //----------------------------------------------------------------------------- return true; } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Get_Memory_Storage **********************************/ /*****************************************************************************/ // AT+CPMS Preferred SMS message storage // AT+CPMS? // +CPMS: "ME",0,25,"ME",0,25,"MT",5,30 // // 0 //----------------------------------------------------------------------------- public boolean Get_Memory_Storage(){ //----------------------------------------------------------------------------- System.out.println("Get Memory Storage(BEGIN)"); //----------------------------------------------------------------------------- String result; String substring; // String [] array_m = new String[128]; array = new String[0]; int in_use = 0; //----------------------------------------------- try{ // AT+CPMS Preferred SMS message storage get_the_response_code_as_a_string = parent.SendCommand("AT+CPMS?\r"); //------------------------------------- // Result: // AT+CPMS? // +CPMS: "SM",0,50,"SM",0,50,"SM",0,50 // // OK //------------------------------------- substring = sm.Get_Substring(':', get_the_response_code_as_a_string); // Result: "SM",32,50,"SM",32,50,"SM",32,50 result = sm.GetRidOfSomeChar('"', substring.trim()); // Result: SM,32,50,SM,32,50,SM,32,50 array = String_Manipulation.Split_String_Into_Array("," , result); // array = sm.Split_String_Into_Array(',' , array_m[0].toString()); /*---------------------------------------------------------------------------*/ for(int i=0; i < array.length ; i++){ // System.out.println(""); System.out.println("Array[" + i + "] = " + array[i] ); } /*---------------------------------------------------------------------------*/ try{ //----------------------------------------------------------------------------- for(int i=0; i < array.length ; i = i+3){ // System.out.println(""); // System.out.println("Array[" + i + "] = " + array[i] ); if( String.valueOf("ME".trim()).equals(array[i].trim()) ){ in_use = Integer.parseInt(array[i+1]); }break; } System.out.println("Break(in_use)"); //----------------------------------------------------------------------------- } catch (NumberFormatException m) { System.out.println("Exception in Get_Memory_Storage(in_use): " + m );} /*---------------------------------------------------------------------------*/ //----------------------------------------------------------------------------- // Array_m[0] = ME,0,25,ME,0,25,MT,5,30 // Array[0] = ME, Array[1] = 0, Array[2] = 25, // Array[3] = ME, Array[4] = 0, Array[5] = 25 // Array[6] = MT, Array[7] = 5, Array[8] = 30 //----------------------------------------------------------------------------- if(in_use > 0) { System.out.println("ME in_use(0) = " + array[0] ); System.out.println("ME in_use(1) = " + array[1] ); System.out.println("ME in_use(2) = " + array[2] ); } System.out.println("ME in_use = " + in_use ); /*---------------------------------------------------------------------------*/ } catch (Exception m) { System.out.println("Exception in Get_Memory_Storage: " + m ); return false; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- System.out.println("Get_Memory_Storage(END)"); return true; //----------------------------------------------------------------------------- }//Get_Memory_Storage() /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Split String into an array **************************/ /*****************************************************************************/ public static String[] Split(String delimiter, String splitStr) { StringBuffer string_buffer = new StringBuffer(); Vector vector = new Vector(); // split char[] chars = splitStr.toCharArray(); for (int i=0; i < chars.length; i++) { if (delimiter.indexOf(chars[i]) != -1) { // we bumbed into a delimiter if (string_buffer.length() > 0) { vector.addElement(string_buffer.toString()); string_buffer.setLength(0); } } else { string_buffer.append(chars[i]); } } // don't forget the "tail"... if (string_buffer.length() > 0) { vector.addElement(string_buffer.toString()); } // convert the vector into an array String[] splitArray = new String[vector.size()]; for (int i=0; i < splitArray.length; i++) { splitArray[i] = (String)vector.elementAt(i); } return splitArray; } /*****************************************************************************/ /*****************************************************************************/ // System.out.println(""); /*****************************************************************************/ /*********************** Append_Array ****************************************/ /*****************************************************************************/ public String [] Append_Array(String to_append[], String to_be_appended[]){ // System.out.println("Append_Array"); String array_to_return [] = new String[0]; /* ------------------------------------------------------------------------- */ try{ //----------------------------------------------------------------------------- Vector vector = new Vector(); //----------------------------------------------------------------------------- for(int i = 0; i < to_append.length; i++ ){ if(to_append[i] != null) vector.addElement(to_append[i]);} //----------------------------------------------------------------------------- for(int i = 0; i < to_be_appended.length; i++ ){ if(to_be_appended[i] != null) vector.addElement(to_be_appended[i]);} //----------------------------------------------------------------------------- if( vector.size() > 0 ){ vector.trimToSize(); array_to_return = new String[vector.size()]; vector.copyInto(array_to_return);} //----------------------------------------------------------------------------- }catch (Exception in) { System.out.println("Exception in Append_Array -> " + in); // parent.exception = true; } //----------------------------------------------------------------------------- return array_to_return; /* ------------------------------------------------------------------------- */ }// END OF Append_Array /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ }//class /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/