code: static int getArrayLengthOfTheField(FieldDefinition fd, BufferObjectDataInput in, int offset) throws IOException {
          int originalPos = in.position();
          try {
              int pos = getStreamPositionOfTheField(fd, in, offset);
              in.position(pos);
              return in.readInt();
          } finally {
              in.position(originalPos);
          }
      }
docs: Reads the length of the given array.
  It does not validate if the current position is actually an array - has to be taken care of by the caller.
  
  @param fd     field of the array
  @param in     data input stream
  @param offset offset to use while stream reading
  @return length of the array
  @throws IOException on any stream errors