/**
  * Split the very first line (Content-Type value) in 3 Strings
  *
  * @return the array of 3 Strings
  */
 private static String[] splitHeaderContentType(String sb) {
   int aStart;
   int aEnd;
   int bStart;
   int bEnd;
   int cStart;
   int cEnd;
   aStart = HttpPostBodyUtil.findNonWhitespace(sb, 0);
   aEnd = sb.indexOf(';');
   if (aEnd == -1) {
     return new String[] {sb, "", ""};
   }
   bStart = HttpPostBodyUtil.findNonWhitespace(sb, aEnd + 1);
   if (sb.charAt(aEnd - 1) == ' ') {
     aEnd--;
   }
   bEnd = sb.indexOf(';', bStart);
   if (bEnd == -1) {
     bEnd = HttpPostBodyUtil.findEndOfString(sb);
     return new String[] {sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), ""};
   }
   cStart = HttpPostBodyUtil.findNonWhitespace(sb, bEnd + 1);
   if (sb.charAt(bEnd - 1) == ' ') {
     bEnd--;
   }
   cEnd = HttpPostBodyUtil.findEndOfString(sb);
   return new String[] {
     sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), sb.substring(cStart, cEnd)
   };
 }
 /**
  * Split the very first line (Content-Type value) in 2 Strings
  *
  * @param sb
  * @return the array of 2 Strings
  */
 private String[] splitHeaderContentType(String sb) {
   int size = sb.length();
   int aStart;
   int aEnd;
   int bStart;
   int bEnd;
   aStart = HttpPostBodyUtil.findNonWhitespace(sb, 0);
   aEnd = HttpPostBodyUtil.findWhitespace(sb, aStart);
   if (aEnd >= size) {
     return new String[] {sb, ""};
   }
   if (sb.charAt(aEnd) == ';') {
     aEnd--;
   }
   bStart = HttpPostBodyUtil.findNonWhitespace(sb, aEnd);
   bEnd = HttpPostBodyUtil.findEndOfString(sb);
   return new String[] {sb.substring(aStart, aEnd), sb.substring(bStart, bEnd)};
 }
 /**
  * Split one header in Multipart
  *
  * @param sb
  * @return an array of String where rank 0 is the name of the header, follows by several values
  *     that were separated by ';' or ','
  */
 private String[] splitMultipartHeader(String sb) {
   ArrayList<String> headers = new ArrayList<String>(1);
   int nameStart;
   int nameEnd;
   int colonEnd;
   int valueStart;
   int valueEnd;
   nameStart = HttpPostBodyUtil.findNonWhitespace(sb, 0);
   for (nameEnd = nameStart; nameEnd < sb.length(); nameEnd++) {
     char ch = sb.charAt(nameEnd);
     if (ch == ':' || Character.isWhitespace(ch)) {
       break;
     }
   }
   for (colonEnd = nameEnd; colonEnd < sb.length(); colonEnd++) {
     if (sb.charAt(colonEnd) == ':') {
       colonEnd++;
       break;
     }
   }
   valueStart = HttpPostBodyUtil.findNonWhitespace(sb, colonEnd);
   valueEnd = HttpPostBodyUtil.findEndOfString(sb);
   headers.add(sb.substring(nameStart, nameEnd));
   String svalue = sb.substring(valueStart, valueEnd);
   String[] values = null;
   if (svalue.indexOf(";") >= 0) {
     values = svalue.split(";");
   } else {
     values = svalue.split(",");
   }
   for (String value : values) {
     headers.add(value.trim());
   }
   String[] array = new String[headers.size()];
   for (int i = 0; i < headers.size(); i++) {
     array[i] = headers.get(i);
   }
   return array;
 }