public String readUTF8String(MemoryBuffer buffer) {
    int numBytes = buffer.readVarUint32Small14();
    buffer.checkReadableBytes(numBytes);
    final byte[] targetArray = buffer.getHeapMemory();
    if (targetArray != null) {
      String str =
          new String(
              targetArray, buffer._unsafeHeapReaderIndex(), numBytes, StandardCharsets.UTF_8);
      buffer.increaseReaderIndex(numBytes);
      return str;
    } else {
      final byte[] tmpArray = getByteArray(numBytes);
      buffer.readBytes(tmpArray, 0, numBytes);
      return new String(tmpArray, 0, numBytes, StandardCharsets.UTF_8);
    }
  }
@Test
  public void testReadUtf8String() {
    Fury fury = getJavaFury();
    for (MemoryBuffer buffer :
        new MemoryBuffer[] {
          MemoryUtils.buffer(32), MemoryUtils.wrap(ByteBuffer.allocateDirect(2048))
        }) {
      StringSerializer serializer = new StringSerializer(fury);
      serializer.write(buffer, "abc你好");
      assertEquals(serializer.read(buffer), "abc你好");
      byte[] bytes = "abc你好".getBytes(StandardCharsets.UTF_8);
      byte UTF8 = 2;
      buffer.writeVarUint64(((long) bytes.length) << 2 | UTF8);
      buffer.writeBytes(bytes);
      assertEquals(serializer.read(buffer), "abc你好");
      assertEquals(buffer.readerIndex(), buffer.writerIndex());
    }
  }