You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/05/22 20:23:17 UTC
cvs commit: xml-soap/java/src/org/apache/soap/util IOUtils.java StringUtils.java
duftler 01/05/22 11:23:14
Modified: java/src/org/apache/soap/util IOUtils.java StringUtils.java
Log:
Removed some extraneous methods from org.apache.soap.util.StringUtils.
Removed some extraneous CVS tags from org.apache.soap.util.IOUtils.CVS: ----------------------------------------------------------------------
Revision Changes Path
1.4 +0 -3 xml-soap/java/src/org/apache/soap/util/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/IOUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IOUtils.java 2000/09/01 03:53:03 1.3
+++ IOUtils.java 2001/05/22 18:23:01 1.4
@@ -55,8 +55,6 @@
* <http://www.apache.org/>.
*/
-/* $Id: IOUtils.java,v 1.3 2000/09/01 03:53:03 sanjiva Exp $ */
-
package org.apache.soap.util;
import java.io.*;
@@ -64,7 +62,6 @@
/**
* This file is a collection of input/output utilities.
*
- * @version $Revision: 1.3 $
* @author Sanjiva Weerawarana
* @author Matthew J. Duftler
*/
1.6 +0 -197 xml-soap/java/src/org/apache/soap/util/StringUtils.java
Index: StringUtils.java
===================================================================
RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/StringUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StringUtils.java 2001/05/21 20:53:11 1.5
+++ StringUtils.java 2001/05/22 18:23:06 1.6
@@ -72,69 +72,8 @@
{
public static final String lineSeparator =
System.getProperty("line.separator", "\n");
- public static final String lineSeparatorStr = cleanString(lineSeparator);
public static String URI_SEPARATION_CHAR = "@";
- // Handles multi-line strings.
- public static String getSafeString(String scriptStr)
- {
- BufferedReader in = new BufferedReader(new StringReader(scriptStr));
- StringBuffer strBuf = new StringBuffer();
- String tempLine,
- previousLine = null;
-
- try
- {
- while ((tempLine = in.readLine()) != null)
- {
- if (previousLine != null)
- {
- strBuf.append("\"" + previousLine + lineSeparatorStr + "\" +" +
- lineSeparator);
- }
-
- previousLine = cleanString(tempLine);
- }
- }
- catch (IOException e)
- {
- }
-
- strBuf.append("\"" + (previousLine != null ? previousLine : "") + "\"" +
- lineSeparator);
-
- return strBuf.toString();
- }
-
- // Ensure that escape sequences are passed through properly.
- public static String cleanString(String str)
- {
- if (str == null)
- return null;
- else
- {
- char[] charArray = str.toCharArray();
- StringBuffer sBuf = new StringBuffer();
-
- for (int i = 0; i < charArray.length; i++)
- switch (charArray[i])
- {
- case '\"' : sBuf.append("\\\"");
- break;
- case '\\' : sBuf.append("\\\\");
- break;
- case '\n' : sBuf.append("\\n");
- break;
- case '\r' : sBuf.append("\\r");
- break;
- default : sBuf.append(charArray[i]);
- break;
- }
-
- return sBuf.toString();
- }
- }
-
/*
This method will return the correct name for a class object representing
a primitive, a single instance of a class, as well as n-dimensional arrays
@@ -197,142 +136,6 @@
classNameBuf.append("[]");
return classNameBuf.toString();
- }
-
- public static String getCommaListFromVector(Vector sourceVector)
- {
- StringBuffer strBuf = new StringBuffer();
-
- for (int i = 0; i < sourceVector.size(); i++)
- {
- strBuf.append((i > 0 ? ", " : "") +
- sourceVector.elementAt(i));
- }
-
- return strBuf.toString();
- }
-
- /**
- * Get a string consisting of <code>numberOfChars</code> theChars.
- *
- * @return a string consisting of <code>numberOfChars</code> theChars.
- */
- public static String getChars(int numberOfChars, char theChar)
- {
- if (numberOfChars <= 0)
- return "";
-
- StringBuffer sRet = new StringBuffer(numberOfChars);
-
- for (int i = 0; i < numberOfChars; i++)
- sRet.append(theChar);
-
- return sRet.toString();
- }
-
- public static boolean isValidIdentifierName(String identifierName)
- {
- if (identifierName == null || identifierName.length() == 0)
- return false;
-
- char[] chars = identifierName.toCharArray();
-
- if (!Character.isJavaIdentifierStart(chars[0]))
- return false;
-
- for (int i = 1; i < chars.length; i++)
- if (!Character.isJavaIdentifierPart(chars[i]))
- return false;
-
- return true;
- }
-
- public static boolean isValidPackageName(String packageName)
- {
- if (packageName == null)
- return false;
- else if (packageName.length() == 0)
- // Empty is ok.
- return true;
-
- StringTokenizer strTok = new StringTokenizer(packageName, ".", true);
-
- // Should have an odd number of tokens (including '.' delimiters).
- if (strTok.countTokens() % 2 != 1)
- return false;
-
- // Must start with a valid identifier name.
- if (!isValidIdentifierName(strTok.nextToken()))
- return false;
-
- // ... followed by 0 or more of ".ValidIdentifier".
- while (strTok.hasMoreTokens())
- {
- // Must be a '.'.
- if (!strTok.nextToken().equals("."))
- return false;
-
- // Must be a valid identifier name.
- if (strTok.hasMoreTokens())
- {
- if (!isValidIdentifierName(strTok.nextToken()))
- return false;
- }
- else
- return false;
- }
-
- return true;
- }
-
- public static String classNameToVarName(String className)
- {
- // Might represent an array.
- int arrayDim = 0;
-
- while (className.endsWith("[]"))
- {
- className = className.substring(0, className.length() - 2);
- arrayDim++;
- }
-
- int iLastPeriod = className.lastIndexOf('.');
- String varName = Introspector.decapitalize(
- iLastPeriod != -1
- ? className.substring(iLastPeriod + 1)
- : className);
-
- if (arrayDim > 0)
- {
- varName += "_" + arrayDim + "D";
- }
-
- return getValidIdentifierName(varName);
- }
-
- public static String getValidIdentifierName(String identifierName)
- {
- if (identifierName == null || identifierName.length() == 0)
- return null;
-
- StringBuffer strBuf = new StringBuffer();
-
- char[] chars = identifierName.toCharArray();
-
- strBuf.append(Character.isJavaIdentifierStart(chars[0])
- ? chars[0]
- : '_'
- );
-
- for (int i = 1; i < chars.length; i++)
- {
- strBuf.append(Character.isJavaIdentifierPart(chars[i])
- ? chars[i]
- : '_'
- );
- }
-
- return strBuf.toString();
}
/*