MCPcopy Index your code
hub / github.com/questdb/questdb / putUtf8

Method putUtf8

core/src/test/java/io/questdb/test/tools/TestUtils.java:1933–1951  ·  view source on GitHub ↗
(TableWriter.Row r, String s, int columnIndex, boolean symbol)

Source from the content-addressed store, hash-verified

1931 }
1932
1933 public static void putUtf8(TableWriter.Row r, String s, int columnIndex, boolean symbol) {
1934 byte[] bytes = s.getBytes(Files.UTF_8);
1935 long len = bytes.length;
1936 long p = Unsafe.malloc(len, MemoryTag.NATIVE_DEFAULT);
1937 try {
1938 for (int i = 0; i < len; i++) {
1939 Unsafe.putByte(p + i, bytes[i]);
1940 }
1941 DirectUtf8String seq = new DirectUtf8String();
1942 seq.of(p, p + len);
1943 if (symbol) {
1944 r.putSymUtf8(columnIndex, seq);
1945 } else {
1946 r.putStrUtf8(columnIndex, seq);
1947 }
1948 } finally {
1949 Unsafe.free(p, len, MemoryTag.NATIVE_DEFAULT);
1950 }
1951 }
1952
1953 public static StringSink putWithLeadingZeroIfNeeded(StringSink seq, int len, int value) {
1954 seq.clear(len);

Callers 3

testUtf8Method · 0.95

Calls 7

mallocMethod · 0.95
putByteMethod · 0.95
ofMethod · 0.95
freeMethod · 0.95
putSymUtf8Method · 0.65
putStrUtf8Method · 0.65
getBytesMethod · 0.45

Tested by

no test coverage detected