commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang Tokenizer.java
Date Thu, 02 Sep 2004 07:52:35 GMT
scolebourne    2004/09/02 00:52:35

  Modified:    lang/src/java/org/apache/commons/lang Tokenizer.java
  Log:
  Remove cloning from char array methods
  
  Revision  Changes    Path
  1.10      +30 -12    jakarta-commons/lang/src/java/org/apache/commons/lang/Tokenizer.java
  
  Index: Tokenizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/Tokenizer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Tokenizer.java	28 Aug 2004 11:46:19 -0000	1.9
  +++ Tokenizer.java	2 Sep 2004 07:52:35 -0000	1.10
  @@ -229,8 +229,7 @@
       }
   
       /**
  -     * Constructs a tokenizer splitting on space, tab, newline and formfeed
  -     * as per StringTokenizer.
  +     * Constructs a tokenizer splitting on the specified delimiter character.
        * 
        * @param input  the string which is to be parsed
        * @param delim  the field delimiter character
  @@ -280,20 +279,27 @@
       /**
        * Constructs a tokenizer splitting on space, tab, newline and formfeed
        * as per StringTokenizer.
  +     * <p>
  +     * This method is designed for use when you are using a character array in
  +     * your own code. The input is not cloned, so using the tokenizer in this way
  +     * is not thread-safe.
        * 
  -     * @param input  the string which is to be parsed, cloned
  +     * @param input  the string which is to be parsed
        */
       public Tokenizer(char[] input) {
           super();
           this.text = null;
  -        this.chars = (char[]) input.clone();
  +        this.chars = input;
       }
   
       /**
  -     * Constructs a tokenizer splitting on space, tab, newline and formfeed
  -     * as per StringTokenizer.
  +     * Constructs a tokenizer splitting on the specified delimiter character.
  +     * <p>
  +     * This method is designed for use when you are using a character array in
  +     * your own code. The input is not cloned, so using the tokenizer in this way
  +     * is not thread-safe.
        * 
  -     * @param input  the string which is to be parsed, cloned
  +     * @param input  the string which is to be parsed
        * @param delim the field delimiter character
        */
       public Tokenizer(char[] input, char delim) {
  @@ -303,8 +309,12 @@
   
       /**
        * Constructs a tokenizer splitting using the specified delimiter matcher.
  +     * <p>
  +     * This method is designed for use when you are using a character array in
  +     * your own code. The input is not cloned, so using the tokenizer in this way
  +     * is not thread-safe.
        * 
  -     * @param input  the string which is to be parsed, cloned
  +     * @param input  the string which is to be parsed
        * @param delim  the field delimiter matcher
        */
       public Tokenizer(char[] input, Matcher delim) {
  @@ -315,8 +325,12 @@
       /**
        * Constructs a tokenizer splitting on the specified delimiter character
        * and handling quotes using the specified quote character.
  +     * <p>
  +     * This method is designed for use when you are using a character array in
  +     * your own code. The input is not cloned, so using the tokenizer in this way
  +     * is not thread-safe.
        * 
  -     * @param input  the string which is to be parsed, cloned
  +     * @param input  the string which is to be parsed
        * @param delim  the field delimiter character
        * @param quote  the field quoted string character
        */
  @@ -329,7 +343,7 @@
        * Constructs a tokenizer splitting using the specified delimiter matcher
        * and handling quotes using the specified quote matcher.
        * 
  -     * @param input  the string which is to be parsed, cloned
  +     * @param input  the string which is to be parsed
        * @param delim  the field delimiter character
        * @param quote  the field quoted string character
        */
  @@ -413,13 +427,17 @@
        * Reset this tokenizer, giving it a new input string to parse.
        * In this manner you can re-use a tokenizer with the same settings
        * on multiple input lines.
  +     * <p>
  +     * This method is designed for use when you are using a character array in
  +     * your own code. The input is not cloned, so using the tokenizer in this way
  +     * is not thread-safe.
        * 
        * @param input  the new character array to tokenize, cloned
        */
       public void reset(char [] input) {
           reset();
           this.text = null;
  -        chars = (char[]) input.clone();
  +        chars = input;
       }
   
       // ListIterator
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message