Java String Extract extractPacket(String serverPacket)

Here you can find the source of extractPacket(String serverPacket)

Description

Extracts the valuable information from a packet and cuts out the initial hashtag identifier

License

Open Source License

Parameter

Parameter Description
serverPacket - packet received from server

Return

An array of String that contains all the valuable information

Declaration

public static ArrayList<String> extractPacket(String serverPacket) 

Method Source Code

//package com.java2s;
/*************************************************************** 
 * Licensed Materials - Property of breadbox                   *  
 * (c) Copyright breadbox 2014 - All Rights Reserved           * 
 ***************************************************************/

import java.util.ArrayList;

public class Main {
    /**/*from   w  ww . j  av a 2s . c o m*/
     * Extracts the valuable information from a packet and cuts out the initial
     * hashtag identifier
     * 
     * @param serverPacket
     *            - packet received from server
     * @return An array of <code>String</code> that contains all the valuable
     *         information
     */
    public static ArrayList<String> extractPacket(String serverPacket) {
        ArrayList<String> extractedPacket = new ArrayList<String>();
        String[] tmp = serverPacket.split("#");

        /*
         * Ignore tmp[0] which is white space and tmp[1] which is the hashtag
         * identifier #...#
         */
        for (int i = 2; i < tmp.length; i++) {
            extractedPacket.add(tmp[i]);
        }

        return extractedPacket;
    }
}

Related

  1. extractKeyCodes(String codes)
  2. extractLines(String data, int tabWidth)
  3. extractNoPublicDomains(String domains)
  4. extractNumberFromInput(String command)
  5. extractNumbers(String text)
  6. extractParameters(String uri)
  7. extractParamsFromUriTemplateFragment(String value)
  8. extractReferences(String value)
  9. extractStreetName(String address)