Package wt.httpgw

Class EncodingConverter

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class EncodingConverter extends EncodingConverter
Deprecated.
As of 7.0, replaced by {@link #wt.util.EncodingConverter}

Supported API: true
Extendable: false
The class contains utility methods for converting a String into a MIME format called "x-www-form-urlencoded" and vice versa.

To convert a String, each character is examined in turn:

  • The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
  • The space character ' ' is converted into a plus sign '+'.
  • All other characters are converted into an 8-bit byte sequence using a character encoding and the resulting bytes are each represented as a 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte.


Deployment Notes:

    The EncodingConverter is a replacement for WTURLEncoder and is instance based. The EncodingConverter should not be shared amongst threads or used as a static instance unless appropriate synchronization blocks are used to protect the internal buffers from overrighting. This can be done one of two ways. Firstly by declaring the method which calls the encode/decode methods as synchronized, or by placing a syncrhonized block around the actually calls to encode/decode as shown below.



      static EncodingConverter staticEncoder = new EncodingConverter();

      public void sampleMethod(String s)
      {
        synchronized( staticEncoder )
        {
          staticEncoder.encode(s);
        }
      }

  • Constructor Details

    • EncodingConverter

      public EncodingConverter()
      Deprecated.
      Consturctor to create a new EncodingConverter with the encoding set to UTF-8.

      Supported API: true
      See Also:
    • EncodingConverter

      public EncodingConverter(int byteSize)
      Deprecated.
      Constructor to create a new EncodingConverter with an encoding set to UTF-8 and a specified buffer capacity.

      Supported API: true

      Parameters:
      byteSize - The buffer capacity.
      See Also:
    • EncodingConverter

      public EncodingConverter(String encoding)
      Deprecated.
      Constructor to create a new EncodingConverter with a specified encoding.

      Supported API: true
      Parameters:
      encoding - The encoding to use for encode/decoding.
      See Also: