Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Constructor Summary
`UEncoder()`

Method Summary
`void` | `addSafeCharacter(char c)`
`java.lang.String` | `encodeURL(java.lang.String uri)` Utility funtion to re-encode the URL.
`void` | `setEncoding(java.lang.String s)`
`void` | `urlEncode(java.io.Writer buf, byte[] bytes, int off, int len)`
`void` | `urlEncode(java.io.Writer buf, java.lang.String s)` URL Encode string, using a specified encoding.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UEncoder

    public UEncoder()

Method Detail

### setEncoding

    public void setEncoding(java.lang.String s)

### addSafeCharacter

    public void addSafeCharacter(char c)

### urlEncode

    public void urlEncode(java.io.Writer buf,
                          java.lang.String s)
                   throws java.io.IOException

  URL Encode string, using a specified encoding.

  Parameters:
    `s` - string to be encoded
  Throws:
    `java.io.IOException`

### urlEncode

    public void urlEncode(java.io.Writer buf,
                          byte[] bytes,
                          int off,
                          int len)
                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### encodeURL

    public java.lang.String encodeURL(java.lang.String uri)

  Utility funtion to re-encode the URL. Still has problems with charset, since UEncoder mostly ignores it.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Apache Software Foundation. All Rights Reserved.