Package org.eclipse.jetty.util
Class CharsetStringBuilder.DecoderStringBuilder
java.lang.Object
org.eclipse.jetty.util.CharsetStringBuilder.DecoderStringBuilder
- All Implemented Interfaces:
CharsetStringBuilder
- Enclosing interface:
- CharsetStringBuilder
public static class CharsetStringBuilder.DecoderStringBuilder
extends Object
implements CharsetStringBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.CharsetStringBuilder
CharsetStringBuilder.DecoderStringBuilder, CharsetStringBuilder.Iso88591StringBuilder, CharsetStringBuilder.UsAsciiStringBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionDecoderStringBuilder
(CharsetDecoder charsetDecoder, CodingErrorAction onMalformedInput, CodingErrorAction onUnmappableCharacter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(byte b) void
append
(byte[] b, int offset, int length) void
append
(char c) void
append
(CharSequence chars, int offset, int length) void
append
(ByteBuffer buf) build
(boolean ignore) Attempt to build the completed string and reset the buffer, returning a partial string if there are encoding errorsint
length()
void
reset()
Resets this sequence to be empty.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.CharsetStringBuilder
append, build, hasCodingErrors, replaceIncomplete
-
Constructor Details
-
DecoderStringBuilder
public DecoderStringBuilder(CharsetDecoder charsetDecoder, CodingErrorAction onMalformedInput, CodingErrorAction onUnmappableCharacter)
-
-
Method Details
-
append
public void append(byte b) - Specified by:
append
in interfaceCharsetStringBuilder
- Parameters:
b
- An encoded byte to append
-
append
public void append(char c) - Specified by:
append
in interfaceCharsetStringBuilder
- Parameters:
c
- A decoded character to append
-
append
- Specified by:
append
in interfaceCharsetStringBuilder
- Parameters:
chars
- sequence of decoded charactersoffset
- offset into the arraylength
- the number of character to append from the sequence.
-
append
public void append(byte[] b, int offset, int length) - Specified by:
append
in interfaceCharsetStringBuilder
- Parameters:
b
- Array of encoded bytesoffset
- offset into the arraylength
- the number of bytes to append from the array.
-
append
- Specified by:
append
in interfaceCharsetStringBuilder
- Parameters:
buf
- Buffer of encoded bytes to append. The bytes are consumed from the buffer.
-
build
Description copied from interface:CharsetStringBuilder
Attempt to build the completed string and reset the buffer, returning a partial string if there are encoding errors
Note, only some implementations support the
allowPartialString
parameter- Specified by:
build
in interfaceCharsetStringBuilder
- Parameters:
ignore
- true if a partial string is allowed to be returned, false means if complete string cannot be returned, an exception is thrown.- Returns:
- The available string (complete or partial)
- Throws:
CharacterCodingException
- (only ifallowPartialString
is false) thrown if the bytes cannot be correctly decoded or a multibyte sequence is incomplete.
-
length
public int length()- Specified by:
length
in interfaceCharsetStringBuilder
- Returns:
- the length in characters
-
reset
public void reset()Description copied from interface:CharsetStringBuilder
Resets this sequence to be empty.
- Specified by:
reset
in interfaceCharsetStringBuilder
-