Buffers and EncodingsThis package contains buffers and utils to perform encoding/decoding of buffers. That includes byte to char conversions, URL encodings, etc.
Encoding is a critical operation for performance. There are few tricks in this package - the C2B and B2C converters are caching an ISReader/OSWriter and keep everything allocated to do the conversions in any VM without any garbage.
This package must accommodate future extensions and additional converters ( most important: the nio.charset, which should be detected and used if available ). Also, we do have one hand-written UTF8Decoder, and other tuned encoders could be added.
My benchmarks ( I'm costin :-) show only small differences between C2B, B2C and hand-written codders/decoders, so UTF8Decoder may be disabled.
Interface Summary Interface Description ByteChunk.ByteInputChannelInput interface, used when the buffer is empty. ByteChunk.ByteOutputChannelWhen we need more space we'll either grow the buffer ( up to the limit ) or send it to a channel. CharChunk.CharInputChannelInput interface, used when the buffer is empty. CharChunk.CharOutputChannelWhen we need more space we'll either grow the buffer ( up to the limit ) or send it to a channel.
Class Summary Class Description AbstractChunkBase class for the *Chunk implementation to reduce duplication. AsciiThis class implements some basic ASCII character handling functions. Asn1ParserThis is a very basic ASN.1 parser that provides the limited functionality required by Tomcat. Asn1Writer B2CConverterNIO based character decoder. ByteBufferHolderSimple wrapper for a
ByteBufferthat remembers if the buffer has been flipped or not.
ByteBufferUtils ByteChunkThis class is used to represent a chunk of bytes, and utilities to manipulate byte. C2BConverterNIO based character encoder. CharChunkUtilities to manipulate char chunks. CharsetCache CharsetUtil HexUtilsTables useful when converting byte arrays to and from strings of hexadecimal digits. MessageBytesThis class is used to represent a subarray of bytes in an HTTP message. StringCacheThis class implements a String cache for ByteChunk and CharChunk. StringUtilsUtility methods to build a separated list from a given set (not java.util.Set) of inputs and return that list as a string or append it to an existing StringBuilder. UDecoderAll URL decoding happens here. UEncoderEfficient implementation of a UTF-8 encoder. UriUtilUtility class for working with URIs and URLs. Utf8EncoderEncodes characters as bytes using UTF-8.
Enum Summary Enum Description EncodedSolidusHandling UEncoder.SafeCharsSet
Exception Summary Exception Description ByteChunk.BufferOverflowException