Top Description Fields Constructors Methods
io.opentelemetry.api.internal

public final Class TemporaryBuffers

extends Object
Class Inheritance

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 internal and is hence not for public use. Its APIs are unstable and can change at any time.

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<char[]>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static char[]
chars(int len)

A ThreadLocal char[] of size len.

pack-priv static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHAR_ARRAYback to summary
private static final ThreadLocal<char[]> CHAR_ARRAY

Constructor Detail

TemporaryBuffersback to summary
private TemporaryBuffers()

Method Detail

charsback to summary
public static char[] chars(int len)

A ThreadLocal char[] of size len. Take care when using a large value of len as 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 a String.

clearCharsback to summary
pack-priv static void clearChars()