java.lang.Object
org.glassfish.grizzly.http.util.UEncoder
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSafeCharacter(char c) Utility funtion to re-encode the URL.Utility function to re-encode the URL.voidvoidvoidvoidURL Encode string, using a specified encoding.voidURL Encode string, using a specified encoding.
-
Constructor Details
-
UEncoder
public UEncoder()
-
-
Method Details
-
setEncoding
-
addSafeCharacter
public void addSafeCharacter(char c) -
urlEncode
URL Encode string, using a specified encoding.- Parameters:
buf- theWriterto write the encoded result to.s- the String to encode.- Throws:
IOException
-
urlEncode
URL Encode string, using a specified encoding.- Parameters:
buf- theWriterto write the encoded result to.s- the String to encode.toHexUpperCase- the hex string will be in upper case- Throws:
IOException
-
urlEncode
- Throws:
IOException
-
urlEncode
public void urlEncode(Writer buf, byte[] bytes, int off, int len, boolean toHexUpperCase) throws IOException - Throws:
IOException
-
encodeURL
Utility funtion to re-encode the URL. Still has problems with charset, since UEncoder mostly ignores it.- Parameters:
url-
-
encodeURL
Utility function to re-encode the URL. Still has problems with charset, since UEncoder mostly ignores it.- Parameters:
uri- the URI to encode.toHexUpperCase- the hex string will be in upper case
-