UEncoder (Apache Tomcat 7.0.96 API Documentation)

org.apache.tomcat.util.buf

## Class UEncoder

- java.lang.Object
- - org.apache.tomcat.util.buf.UEncoder

-     public final class UEncoder
      extends java.lang.Object

  Efficient implementation for encoders. This class is not thread safe - you need one encoder per thread. The encoder will save and recycle the internal objects, avoiding garbage. You can add extra characters that you want preserved, for example while encoding a URL you can add "/".
  Author:
    Costin Manolache

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UEncoder.SafeCharsSet`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UEncoder()`
    `UEncoder(UEncoder.SafeCharsSet safeCharsSet)` Create a UEncoder with an unmodifiable safe character set.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSafeCharacter(char c)`
    `CharChunk` | `encodeURL(java.lang.String s, int start, int end)` URL Encode string, using a specified encoding.
    `void` | `setEncoding(java.lang.String s)` Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
    `protected void` | `urlEncode(CharChunk out, ByteChunk bb)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UEncoder

          public UEncoder()

    - #### UEncoder

          public UEncoder(UEncoder.SafeCharsSet safeCharsSet)

      Create a UEncoder with an unmodifiable safe character set.

      Calls to `addSafeCharacter(char)` on instances created by this constructor will throw an `IllegalStateException`.

      Parameters:
        `safeCharsSet` - safe characters for this encoder

  - ### Method Detail

    - #### setEncoding

          @Deprecated
          public void setEncoding(java.lang.String s)

      Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.

    - #### addSafeCharacter

          public void addSafeCharacter(char c)

    - #### encodeURL

          public CharChunk encodeURL(java.lang.String s,
                            int start,
                            int end)
                              throws java.io.IOException

      URL Encode string, using a specified encoding.
      Parameters:
        `s` - string to be encoded
        `start` - the beginning index, inclusive
        `end` - the ending index, exclusive
      Throws:
        `java.io.IOException` - If an I/O error occurs

    - #### urlEncode

          protected void urlEncode(CharChunk out,
                       ByteChunk bb)
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.