@NotThreadSafe
public final class PercentEncoder
extends java.lang.Object
UrlPercentEncoders for pre-configured
PercentEncoder instances.| Constructor and Description |
|---|
PercentEncoder(java.util.BitSet safeChars,
java.nio.charset.CharsetEncoder charsetEncoder) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
encode(java.lang.CharSequence input)
Encode the input and return the resulting text as a String.
|
void |
encode(java.lang.CharSequence input,
PercentEncoderOutputHandler handler)
Encode the input and pass output chars to a handler.
|
public PercentEncoder(@Nonnull
java.util.BitSet safeChars,
@Nonnull
java.nio.charset.CharsetEncoder charsetEncoder)
safeChars - the set of chars to NOT encode, stored as a bitset with the int positions corresponding to
those chars set to true. Treated as read only.charsetEncoder - charset encoder to encode characters with. Make sure to not re-use CharsetEncoder instances
across threads.public void encode(@Nonnull
java.lang.CharSequence input,
@Nonnull
PercentEncoderOutputHandler handler)
throws java.nio.charset.MalformedInputException,
java.nio.charset.UnmappableCharacterException
input - input stringhandler - handler to call on each output characterjava.nio.charset.MalformedInputException - if encoder is configured to report errors and malformed input is detectedjava.nio.charset.UnmappableCharacterException - if encoder is configured to report errors and an unmappable character is
detected@Nonnull
public java.lang.String encode(@Nonnull
java.lang.CharSequence input)
throws java.nio.charset.MalformedInputException,
java.nio.charset.UnmappableCharacterException
input - input stringjava.nio.charset.MalformedInputException - if encoder is configured to report errors and malformed input is detectedjava.nio.charset.UnmappableCharacterException - if encoder is configured to report errors and an unmappable character is
detected