Class TemporaryBuffers
java.lang.Object
io.opentelemetry.api.impl.TemporaryBuffers
ThreadLocal buffers for use when creating new derived objects such as Strings.
These buffers are reused within a single thread - it is _not safe_ to use the buffer to generate
multiple derived objects at the same time because the same memory will be used. In general, you
should get a temporary buffer, fill it with data, and finish by converting into the derived
object within the same method to avoid multiple usages of the same buffer.
This class is not intended for use by application developers. Its API is stable and will not be changed or removed in a backwards-incompatible manner.
- Since:
- 1.68.0
-
Method Summary
-
Method Details
-
chars
public static char[] chars(int len) AThreadLocalchar[]of sizelen. Take care when using a large value oflenas this buffer will remain for the lifetime of the thread. The returned buffer will not be zeroed and may be larger than the requested size, you must make sure to fill the entire content to the desired value and set the length explicitly when converting to aString.- Parameters:
len- the minimum buffer capacity- Returns:
- a reusable thread-local character buffer with capacity of at least
len
-