public class PercentCodec extends java.lang.Object implements BinaryEncoder, BinaryDecoder
This class is immutable. It is also thread-safe besides using BitSet which is not thread-safe, but its public interface only call the access
| Constructor and Description |
|---|
PercentCodec()
Constructs a Percent coded that will encode all the non US-ASCII characters using the Percent-Encoding
while it will not encode all the US-ASCII characters, except for character '%' that is used as escape
character for Percent-Encoding.
|
PercentCodec(byte[] alwaysEncodeChars,
boolean plusForSpace)
Constructs a Percent codec by specifying the characters that belong to US-ASCII that should
always be encoded.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decode(byte[] bytes)
Decode bytes encoded with Percent-Encoding based on RFC 3986.
|
java.lang.Object |
decode(java.lang.Object obj)
Decodes a byte[] Object, whose bytes are encoded with Percent-Encoding.
|
byte[] |
encode(byte[] bytes)
Percent-Encoding based on RFC 3986.
|
java.lang.Object |
encode(java.lang.Object obj)
Encodes an object into using the Percent-Encoding.
|
public PercentCodec()
public PercentCodec(byte[] alwaysEncodeChars,
boolean plusForSpace)
alwaysEncodeChars - the unsafe characters that should always be encodedplusForSpace - the flag defining if the space character should be encoded as '+'public byte[] encode(byte[] bytes)
throws EncoderException
encode in interface BinaryEncoderbytes - Data to be encodedEncoderException - thrown if the Encoder encounters a failure condition during the encoding process.public byte[] decode(byte[] bytes)
throws DecoderException
decode in interface BinaryDecoderbytes - A byte array which has been encoded with the appropriate encoderDecoderException - A decoder exception is thrown if a Decoder encounters a failure condition during the decode process.public java.lang.Object encode(java.lang.Object obj)
throws EncoderException
encode in interface Encoderobj - the object to encodeEncoderException - if the object is not a byte arraypublic java.lang.Object decode(java.lang.Object obj)
throws DecoderException
decode in interface Decoderobj - the object to decodeDecoderException - if the object is not a byte arrayCopyright © 2010 - 2023 Adobe. All Rights Reserved