Package com.amazonaws.xray.internal
Class RecyclableBuffers
- java.lang.Object
-
- com.amazonaws.xray.internal.RecyclableBuffers
-
public final class RecyclableBuffers extends java.lang.ObjectThreadLocalbuffers for use when creating new derived objects such asStrings. 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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]bytes(int length)AThreadLocalbyte[]of lengthlength.static char[]chars(int length)AThreadLocalchar[]of lengthlength.static java.lang.StringBuilderstringBuilder()AThreadLocalStringBuilder.
-
-
-
Method Detail
-
stringBuilder
public static java.lang.StringBuilder stringBuilder()
AThreadLocalStringBuilder. Take care when filling a large value into this buffer because the memory will remain for the lifetime of the thread.
-
chars
public static char[] chars(int length)
AThreadLocalchar[]of lengthlength. The array is not zeroed in any way - every character of a resultingStringmust be set explicitly. The array returned may be longer thanlength- always explicitly set the length when using the result, for example by callingString.valueOf(char[], int, int).
-
bytes
public static byte[] bytes(int length)
AThreadLocalbyte[]of lengthlength. The array is not zeroed in any way.
-
-