Package org.eclipse.jetty.util
Interface CharsetStringBuilder
-
- All Known Implementing Classes:
CharsetStringBuilder.DecoderStringBuilder,CharsetStringBuilder.Iso88591StringBuilder,CharsetStringBuilder.UsAsciiStringBuilder
@Deprecated(since="2021-05-27") public interface CharsetStringBuilderDeprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.Build a string from a sequence of bytes and/or characters.
Implementations of this interface are optimized for processing a mix of calls to already decoded character based appends (e.g.
append(char)and calls to undecoded byte methods (e.g.append(byte). This is particularly useful for decoding % encoded strings that are mostly already decoded but may contain escaped byte sequences that are not decoded. The standardCharsetDecoderAPI is not well suited for this use-case.Any coding errors in the string will be reported by a
CharacterCodingExceptionthrown from thebuild()method.- See Also:
for UTF-8 decoding with replacement of coding errors and/or fast fail behaviour.,for decoding arbitrary s with control over .
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCharsetStringBuilder.DecoderStringBuilderDeprecated.static classCharsetStringBuilder.Iso88591StringBuilderDeprecated.static classCharsetStringBuilder.UsAsciiStringBuilderDeprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidappend(byte b)Deprecated.default voidappend(byte[] bytes)Deprecated.default voidappend(byte[] b, int offset, int length)Deprecated.voidappend(char c)Deprecated.default voidappend(java.lang.CharSequence chars, int offset, int length)Deprecated.default voidappend(java.nio.ByteBuffer buf)Deprecated.java.lang.Stringbuild()Deprecated.Build the completed string and reset the buffer.static CharsetStringBuilderforCharset(java.nio.charset.Charset charset)Deprecated.voidreset()Deprecated.
-
-
-
Method Detail
-
append
void append(byte b)
Deprecated.- Parameters:
b- An encoded byte to append
-
append
void append(char c)
Deprecated.- Parameters:
c- A decoded character to append
-
append
default void append(byte[] bytes)
Deprecated.- Parameters:
bytes- Array of encoded bytes to append
-
append
default void append(byte[] b, int offset, int length)Deprecated.- Parameters:
b- Array of encoded bytesoffset- offset into the arraylength- the number of bytes to append from the array.
-
append
default void append(java.lang.CharSequence chars, int offset, int length)Deprecated.- Parameters:
chars- sequence of decoded charactersoffset- offset into the arraylength- the number of character to append from the sequence.
-
append
default void append(java.nio.ByteBuffer buf)
Deprecated.- Parameters:
buf- Buffer of encoded bytes to append. The bytes are consumed from the buffer.
-
build
java.lang.String build() throws java.nio.charset.CharacterCodingExceptionDeprecated.Build the completed string and reset the buffer.
- Returns:
- The decoded built string which must be complete in regard to any multibyte sequences.
- Throws:
java.nio.charset.CharacterCodingException- If the bytes cannot be correctly decoded or a multibyte sequence is incomplete.
-
reset
void reset()
Deprecated.
-
forCharset
static CharsetStringBuilder forCharset(java.nio.charset.Charset charset)
Deprecated.- Parameters:
charset- The charset- Returns:
- A
CharsetStringBuildersuitable for the charset.
-
-