Class HttpResource

java.lang.Object
org.miaixz.bus.core.io.resource.HttpResource
All Implemented Interfaces:
Serializable, Resource

public class HttpResource extends Object implements Resource, Serializable
HTTP资源,用于自定义表单数据,可自定义Content-Type
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • HttpResource

      public HttpResource(Resource resource, String contentType)
      构造
      Parameters:
      resource - 资源,非空
      contentType - Content-Type类型,null表示不设置
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Resource
      获取资源名,例如文件资源的资源名为文件名
      Specified by:
      getName in interface Resource
      Returns:
      资源名
    • getUrl

      public URL getUrl()
      Description copied from interface: Resource
      获得解析后的URL,无对应URL的返回null
      Specified by:
      getUrl in interface Resource
      Returns:
      解析后的URL
    • size

      public long size()
      Description copied from interface: Resource
      获取资源大小
      Specified by:
      size in interface Resource
      Returns:
      资源大小
    • getStream

      public InputStream getStream()
      Description copied from interface: Resource
      Specified by:
      getStream in interface Resource
      Returns:
      InputStream
    • getContentType

      public String getContentType()
      获取自定义Content-Type类型
      Returns:
      Content-Type类型