public int getLength() {
    if (part == null) {
      return 0;
    } else if (part instanceof byte[]) {
      return ((byte[]) part).length;
    } else if (part instanceof StoredObject) {
      return ((StoredObject) part).getDataSize();
    } else {
      return ((HeapDataOutputStream) part).size();
    }
  }
Return the length of the part. The length is the number of bytes needed for its serialized
form.
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java