incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1134929 - in /incubator/lcf/trunk: ./ connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/ connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/ connectors/gts/...
Date Sun, 12 Jun 2011 14:22:03 GMT
Author: kwright
Date: Sun Jun 12 14:22:02 2011
New Revision: 1134929

URL: http://svn.apache.org/viewvc?rev=1134929&view=rev
Log:
Fix for CONNECTORS-211.

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
    incubator/lcf/trunk/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java
    incubator/lcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
    incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
    incubator/lcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
    incubator/lcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
    incubator/lcf/trunk/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
    incubator/lcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java
    incubator/lcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
    incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
    incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Sun Jun 12 14:22:02 2011
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 0.3-dev =========================
 
+CONNECTORS-211: Move pack() and unpack() utility methods into the
+connector base class.
+(Karl Wright)
+
 CONNECTORS-210: Handle RuntimeException exceptions better in
 connector factories.
 (Farzad Valad, Karl Wright)

Modified: incubator/lcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java (original)
+++ incubator/lcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java Sun Jun 12 14:22:02 2011
@@ -3930,113 +3930,6 @@ public class DCTM extends org.apache.man
     return rval;
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the object to unpack the list into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Class that tracks paths associated with folder IDs, and also keeps track of the name
   * of the metadata attribute to use for the path.
   */

Modified: incubator/lcf/trunk/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java (original)
+++ incubator/lcf/trunk/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java Sun Jun 12 14:22:02 2011
@@ -3916,113 +3916,4 @@ public class FilenetConnector extends or
     return rval;
   }
 
-
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the place to write the unpacked array into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
-
 }

Modified: incubator/lcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java (original)
+++ incubator/lcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java Sun Jun 12 14:22:02 2011
@@ -781,113 +781,6 @@ public class GTSConnector extends org.ap
 
   // Protected methods
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array into which to write the unpacked result.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Fingerprint a file!
   * Pass in the name of the (local) temporary file that we should be looking at.
   * This method will read it as needed until the file has been identified (or found

Modified: incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ incubator/lcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java Sun Jun 12 14:22:02 2011
@@ -2037,113 +2037,6 @@ public class SharedDriveConnector extend
     return getFileCanonicalPath(new SmbFile(uri,pa));
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to write the unpacked results into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   // These methods allow me to experiment with cluster-mandated error handling on an entirely local level.  They correspond to individual SMBFile methods.
 
   /** Get canonical path */

Modified: incubator/lcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java (original)
+++ incubator/lcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java Sun Jun 12 14:22:02 2011
@@ -1573,113 +1573,6 @@ public class JDBCConnector extends org.a
     return rval;
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to write the unpacked result into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Create an entity identifier from a querystring and a parameter list.
   */
   protected static String createQueryString(String queryText, ArrayList paramList)

Modified: incubator/lcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ incubator/lcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java Sun Jun 12 14:22:02 2011
@@ -4171,113 +4171,6 @@ public class LivelinkConnector extends o
     startPos = unpack(attribute,value,startPos,':');
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to write the unpacked result into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Given a path string, get a list of folders and projects under that node.
   *@param pathString is the current path (folder names and project names, separated by dots (.)).
   *@return a list of folder and project names, in sorted order, or null if the path was invalid.

Modified: incubator/lcf/trunk/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java (original)
+++ incubator/lcf/trunk/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java Sun Jun 12 14:22:02 2011
@@ -3718,114 +3718,6 @@ public class MeridioConnector extends or
     return rval;
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to fill with the unpacked list.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
-
   private static String [] getMIMETypes
   (
     DocumentSpecification spec

Modified: incubator/lcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java (original)
+++ incubator/lcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java Sun Jun 12 14:22:02 2011
@@ -5049,114 +5049,6 @@ public class RSSConnector extends org.ap
     return activities.checkMimeTypeIndexable(contentType);
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to fill with the unpacked data.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
-
   /** Given the current parameters, find the correct throttled fetcher object
   * (or create one if not there).
   */

Modified: incubator/lcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ incubator/lcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java Sun Jun 12 14:22:02 2011
@@ -4906,113 +4906,6 @@ public class SharePointRepository extend
     return sb.toString();
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array to write the unpacked result into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Metadata information gleaned from document paths and specification.
   */
   protected static class MetadataInformation

Modified: incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java (original)
+++ incubator/lcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java Sun Jun 12 14:22:02 2011
@@ -1588,113 +1588,4 @@ public class SolrConnector extends org.a
 
   }
 
-  // Protected methods
-
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the output array to put the unpacked values into.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
 }

Modified: incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java (original)
+++ incubator/lcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java Sun Jun 12 14:22:02 2011
@@ -6758,113 +6758,6 @@ public class WebcrawlerConnector extends
     return rval;
   }
 
-  /** Stuffer for packing a single string with an end delimiter */
-  protected static void pack(StringBuilder output, String value, char delimiter)
-  {
-    int i = 0;
-    while (i < value.length())
-    {
-      char x = value.charAt(i++);
-      if (x == '\\' || x == delimiter)
-        output.append('\\');
-      output.append(x);
-    }
-    output.append(delimiter);
-  }
-
-  /** Unstuffer for the above. */
-  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
-  {
-    while (startPosition < value.length())
-    {
-      char x = value.charAt(startPosition++);
-      if (x == '\\')
-      {
-        if (startPosition < value.length())
-          x = value.charAt(startPosition++);
-      }
-      else if (x == delimiter)
-        break;
-      sb.append(x);
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of fixed length */
-  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
-  {
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of fixed length */
-  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < output.length)
-    {
-      sb.setLength(0);
-      startPosition = unpack(sb,value,startPosition,delimiter);
-      output[i++] = sb.toString();
-    }
-    return startPosition;
-  }
-
-  /** Stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, ArrayList values, char delimiter)
-  {
-    pack(output,Integer.toString(values.size()),delimiter);
-    int i = 0;
-    while (i < values.size())
-    {
-      pack(output,values.get(i++).toString(),delimiter);
-    }
-  }
-
-  /** Another stuffer for packing lists of variable length */
-  protected static void packList(StringBuilder output, String[] values, char delimiter)
-  {
-    pack(output,Integer.toString(values.length),delimiter);
-    int i = 0;
-    while (i < values.length)
-    {
-      pack(output,values[i++],delimiter);
-    }
-  }
-
-  /** Unstuffer for unpacking lists of variable length.
-  *@param output is the array into which the unpacked output is written.
-  *@param value is the value to unpack.
-  *@param startPosition is the place to start the unpack.
-  *@param delimiter is the character to use between values.
-  *@return the next position beyond the end of the list.
-  */
-  protected static int unpackList(ArrayList output, String value, int startPosition, char delimiter)
-  {
-    StringBuilder sb = new StringBuilder();
-    startPosition = unpack(sb,value,startPosition,delimiter);
-    try
-    {
-      int count = Integer.parseInt(sb.toString());
-      int i = 0;
-      while (i < count)
-      {
-        sb.setLength(0);
-        startPosition = unpack(sb,value,startPosition,delimiter);
-        output.add(sb.toString());
-        i++;
-      }
-    }
-    catch (NumberFormatException e)
-    {
-    }
-    return startPosition;
-  }
-
   /** Calculate events that should be associated with a document. */
   protected String[] calculateDocumentEvents(INamingActivity activities, String documentIdentifier)
   {

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java?rev=1134929&r1=1134928&r2=1134929&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connector/BaseConnector.java Sun Jun 12 14:22:02 2011
@@ -185,4 +185,114 @@ public abstract class BaseConnector impl
   {
   }
 
+  // Useful pack/unpack methods.  These are typically used for version strings, which
+  // appear in some kinds of connectors (but not others).
+  
+  /** Stuffer for packing a single string with an end delimiter */
+  protected static void pack(StringBuilder output, String value, char delimiter)
+  {
+    int i = 0;
+    while (i < value.length())
+    {
+      char x = value.charAt(i++);
+      if (x == '\\' || x == delimiter)
+        output.append('\\');
+      output.append(x);
+    }
+    output.append(delimiter);
+  }
+
+  /** Unstuffer for the above. */
+  protected static int unpack(StringBuilder sb, String value, int startPosition, char delimiter)
+  {
+    while (startPosition < value.length())
+    {
+      char x = value.charAt(startPosition++);
+      if (x == '\\')
+      {
+        if (startPosition < value.length())
+          x = value.charAt(startPosition++);
+      }
+      else if (x == delimiter)
+        break;
+      sb.append(x);
+    }
+    return startPosition;
+  }
+
+  /** Stuffer for packing lists of fixed length */
+  protected static void packFixedList(StringBuilder output, String[] values, char delimiter)
+  {
+    int i = 0;
+    while (i < values.length)
+    {
+      pack(output,values[i++],delimiter);
+    }
+  }
+
+  /** Unstuffer for unpacking lists of fixed length */
+  protected static int unpackFixedList(String[] output, String value, int startPosition, char delimiter)
+  {
+    StringBuilder sb = new StringBuilder();
+    int i = 0;
+    while (i < output.length)
+    {
+      sb.setLength(0);
+      startPosition = unpack(sb,value,startPosition,delimiter);
+      output[i++] = sb.toString();
+    }
+    return startPosition;
+  }
+
+  /** Stuffer for packing lists of variable length */
+  protected static void packList(StringBuilder output, List<String> values, char delimiter)
+  {
+    pack(output,Integer.toString(values.size()),delimiter);
+    int i = 0;
+    while (i < values.size())
+    {
+      pack(output,values.get(i++).toString(),delimiter);
+    }
+  }
+
+  /** Another stuffer for packing lists of variable length */
+  protected static void packList(StringBuilder output, String[] values, char delimiter)
+  {
+    pack(output,Integer.toString(values.length),delimiter);
+    int i = 0;
+    while (i < values.length)
+    {
+      pack(output,values[i++],delimiter);
+    }
+  }
+
+  /** Unstuffer for unpacking lists of variable length.
+  *@param output is the array to write the unpacked result into.
+  *@param value is the value to unpack.
+  *@param startPosition is the place to start the unpack.
+  *@param delimiter is the character to use between values.
+  *@return the next position beyond the end of the list.
+  */
+  protected static int unpackList(List<String> output, String value, int startPosition, char delimiter)
+  {
+    StringBuilder sb = new StringBuilder();
+    startPosition = unpack(sb,value,startPosition,delimiter);
+    try
+    {
+      int count = Integer.parseInt(sb.toString());
+      int i = 0;
+      while (i < count)
+      {
+        sb.setLength(0);
+        startPosition = unpack(sb,value,startPosition,delimiter);
+        output.add(sb.toString());
+        i++;
+      }
+    }
+    catch (NumberFormatException e)
+    {
+    }
+    return startPosition;
+  }
+
 }
\ No newline at end of file



Mime
View raw message