tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cos...@gmail.com>
Subject Re: svn commit: r376730 - /tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
Date Fri, 10 Feb 2006 19:38:15 GMT
I don't remember refusing making CharChunk implement CharSequence, at least
not recently - I think it would
be a great idea ! Older versions of tomcat that need pre-1.5 support will
need to use a branch.

Costin

On 2/10/06, remm@apache.org <remm@apache.org> wrote:
>
> Author: remm
> Date: Fri Feb 10 07:20:44 2006
> New Revision: 376730
>
> URL: http://svn.apache.org/viewcvs?rev=376730&view=rev
> Log:
> - Have CharCHunk implement CharSequence, so that a CharChunk can be given
> to a Java 5 regexp matcher
>   without having to do a useless toString on it first. Typically, it would
> be the URL.
> - For some reason Costin refused this a while ago. Maybe there was a
> misunderstanding as to what
>   the proposed change was about, as there's no functional change to
> CharChunk.
>   Is this change still refused ?
>
> Modified:
>
>     tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
>
> Modified:
> tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
> URL:
> http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java?rev=376730&r1=376729&r2=376730&view=diff
>
> ==============================================================================
> ---
> tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
> (original)
> +++
> tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java
> Fri Feb 10 07:20:44 2006
> @@ -30,7 +30,7 @@
>   * @author Costin Manolache
>   * @author Remy Maucherat
>   */
> -public final class CharChunk implements Cloneable, Serializable {
> +public final class CharChunk implements Cloneable, Serializable,
> CharSequence {
>
>      // Input interface, used when the buffer is emptied.
>      public static interface CharInputChannel {
> @@ -695,4 +695,26 @@
>         return b;
>      }
>
> +    // Char sequence impl
> +
> +    public char charAt(int index) {
> +        return buff[index + start];
> +    }
> +
> +    public CharSequence subSequence(int start, int end) {
> +        try {
> +            CharChunk result = (CharChunk) this.clone();
> +            result.setOffset(this.start + start);
> +            result.setEnd(this.start + end);
> +            return result;
> +        } catch (CloneNotSupportedException e) {
> +            // Cannot happen
> +            return null;
> +        }
> +    }
> +
> +    public int length() {
> +        return end - start;
> +    }
> +
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message