return the given content type or try to guess from stream or file name. Depending of the available data.

@return the content type
485204
public String getContentType() {
    if (contentType != null) {
      return contentType;
    }

    if (dataStream != null) {
      try {
        contentType = URLConnection.guessContentTypeFromStream(dataStream);
      } catch (IOException ioe) {
        // ignore exception
      }
    }

    if (data != null) {
      contentType = URLConnection.guessContentTypeFromName(filename);
    }

    // fallback - if we have no contenttype and cannot detect one, use 'application/octet-stream'
    if (contentType == null) {
      contentType = "application/octet-stream";
    }

    return contentType;
  }
119674
private ContentType getContentType() {
        String contentTypeValue = m_request.getContentType();
        if (contentTypeValue == null) {
            return ContentType.TEXT_XML;
        }
        return new ContentType(contentTypeValue);
    }
136767
public com.google.api.ads.adwords.axis.v201809.cm.ContentLabelType getContentLabelType() {
        return contentLabelType;
    }
695102
private String contentType(ResponseWrapper responseWrapper) {
        return StringUtil.isEmpty(responseWrapper.getHttpContentType()) ? Config.getContentType() : responseWrapper.getHttpContentType();
    }
375443
def content_type(self) -> ContentType:
        """"""
        if self._ctype:
            return self._ctype
        return (ContentType.config if self.parent.config else
                ContentType.nonconfig)
177013
public Object read(InputStream is, Class type, MediaType mediaType)
            throws IOException {
        XStream xstream = getXStreamInstance(mediaType);
        if (xstream != null) {
            return xstream.fromXML(is);
        } else {
            throw new IllegalArgumentException("Content-type: "
                    + mediaType.getType() + " is currently not supported for "
                    + type.getName());
        }
    }
134006
public function getContentType()
    {
        $contentType = null;
        $_contentType = $this->getHeader('Content-Type');
        if (!empty($_contentType)) {
            $_contentType = explode(';', $_contentType[0]);
            $contentType = $_contentType[0];
        }

        return $contentType;
    }
755972
def content_type(self, request=None, response=None):
        """"""
        if callable(self.outputs.content_type):
            return self.outputs.content_type(request=request, response=response)
        else:
            return self.outputs.content_type
1306820
public function get_content_type() {
		$headers = wp_remote_retrieve_headers( $this->response );
		if ( ! $headers ) {
			return;
		}

		if ( ! is_object( $headers ) || ! method_exists( $headers, 'offsetGet' ) ) {
			return;
		}

		return $headers->offsetGet( 'content-type' );
	}
1200926
public MediaType getContentType() {
		String value = getFirst(CONTENT_TYPE);
		return (StringUtils.hasLength(value) ? MediaType.parseMediaType(value) : null);
	}
52797
public Response contentType(String contentType) {
        checkCommitted();

        header(HttpConstants.Header.CONTENT_TYPE, contentType);
        httpServletResponse.setContentType(contentType);

        return this;
    }
554321
@NotNull
    public final EnhancedMimeType getDataContentType() {
        if (dataContentType == null) {
            dataContentType = EnhancedMimeType.create(dataContentTypeStr);
        }
        return dataContentType;
    }
439484
public String getResourceType() {
        if (resourceType == null) {
            resourceType = "";
            String type = resource.getResourceType();
            if (StringUtils.isBlank(type) || getPrimaryType().equals(type)) {
                Resource contentResource = getContentResource();
                if (contentResource != null) {
                    type = contentResource.getResourceType();
                    if (StringUtils.isNotBlank(type)) {
                        ResourceHandle handle = ResourceHandle.use(contentResource);
                        if (type.equals(handle.getPrimaryType())) {
                            type = null;
                        }
                    }
                }
            }
            if (StringUtils.isNotBlank(type)) {
                // check for a real existing resource type
                if (!Resource.RESOURCE_TYPE_NON_EXISTING.equals(type)) {
                    resourceType = type;
                }
            }
        }
        return resourceType;
    }
645502
public static JavaType findRootType(JavaType contentType) {

		if (contentType.hasGenericTypes()) {
			return findRootType(contentType.containedType(0));
		} else {
			return contentType;
		}
	}
161549
public static String getContentType(String ext) {
        String ct = extToContentType.get(ext);
        if (ct == null)
            ct = isBinary(ext) ? "application/octet-stream" : "text/plain";
        return ct;
    }
616831
public function getContentType()
		{

			foreach (self::$contentTypeMap as $ct => $type) {
				if ($type == $this->type) {
					return $ct;
				}
			}
			return false;

		}
176992
def content_type(self) -> str:
        """"""
        raw = self._headers.get(hdrs.CONTENT_TYPE)  # type: ignore
        if self._stored_content_type != raw:
            self._parse_content_type(raw)
        return self._content_type