public static int write(IDeviceID deviceID, IWALByteBufferView buffer) {
    if (deviceID == null) {
      return write(NO_BYTE_TO_READ, buffer);
    }
    int len = 0;
    len += write(deviceID.segmentNum(), buffer);
    for (int i = 0; i < deviceID.segmentNum(); i++) {
      String segment = (String) deviceID.segment(i);
      len += write(segment, buffer);
    }
    return len;
  }
Write IDeviceID to byteBuffer.

@return the length of string represented by byte[].
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALWriteUtils.java