org.apache.tomcat.util.buf |
Buffers and Encodings
This 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 a ISReader/OSWriter and keep everything allocated to do the conversions
in any VM without any garbage.
This package must accomodate future extensions and additional converters ( most imporant: 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.
|
Java Source File Name | Type | Comment |
Ascii.java | Class | This class implements some basic ASCII character handling functions. |
B2CConverter.java | Class | Efficient conversion of bytes to character .
This uses the standard JDK mechansim - a reader - but provides mechanisms
to recycle all the objects that are used. |
Base64.java | Class | This class provides encode/decode for RFC 2045 Base64 as
defined by RFC 2045, N. |
ByteChunk.java | Class | This class is used to represent a chunk of bytes, and
utilities to manipulate byte[].
The buffer can be modified and used for both input and output.
There are 2 modes: The chunk can be associated with a sink - ByteInputChannel or ByteOutputChannel,
which will be used when the buffer is empty ( on input ) or filled ( on output ).
For output, it can also grow. |
C2BConverter.java | Class | Efficient conversion of character to bytes.
This uses the standard JDK mechansim - a writer - but provides mechanisms
to recycle all the objects that are used. |
CharChunk.java | Class | Utilities to manipluate char chunks. |
DateTool.java | Class | Common place for date utils. |
HexUtils.java | Class | Library of utility methods useful in dealing with converting byte arrays
to and from strings of hexadecimal digits.
Code from Ajp11, from Apache's JServ.
author: Craig R. |
MessageBytes.java | Class | This class is used to represent a subarray of bytes in an HTTP message.
It represents all request/response elements. |
StringCache.java | Class | This class implements a String cache for ByteChunk and CharChunk. |
TimeStamp.java | Class | Main tool for object expiry. |
UDecoder.java | Class | All URL decoding happens here. |
UEncoder.java | Class | Efficient implementation for encoders. |
UTF8Decoder.java | Class | Moved from ByteChunk - code to convert from UTF8 bytes to chars.
Not used in the current tomcat3.3 : the performance gain is not very
big if the String is created, only if we avoid that and work only
on char[]. |