code: public static String unquote(String str)
          throws Exception {
          int len = str.length();
          StringBuffer buf = new StringBuffer(len);
          boolean inQuotes = false;
          char c;
          int i = 0;
  
          if (str.charAt(i) == '"') {
              inQuotes = true;
              i++;
          }
          while(i < len) {
              c = str.charAt(i);
              if (inQuotes) {
                  if (c == '"') {
                      inQuotes = false;
                  } else if (c == '\\') {
                      buf.append(str.charAt(++i));
                  } else {
                      buf.append(c);
                  }
              } else {
                  if (c == '\r') {
                      if (str.charAt(i++) != '\n') {
                          throw new Exception("Malformed string.");
                      }
                  } else if (c == '"') {
                      inQuotes = true;
                      i++;
                  } else {
                      buf.append(c);
                  }
              }
              i++;
          }
          return buf.toString();
      }
docs: Dequotifies a specified string.
  The quotes are removed and each \" is replaced with " and
  each \\ is replaced with \.
  
  @param str the string to dequotify.
  @return unquotified string.