java.net.HttpURLConnection.guessContentTypeFromStream()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(271)

本文整理了Java中java.net.HttpURLConnection.guessContentTypeFromStream()方法的一些代码示例,展示了HttpURLConnection.guessContentTypeFromStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpURLConnection.guessContentTypeFromStream()方法的具体详情如下:
包路径:java.net.HttpURLConnection
类名称:HttpURLConnection
方法名:guessContentTypeFromStream

HttpURLConnection.guessContentTypeFromStream介绍

暂无

代码示例

代码示例来源:origin: wso2-attic/esb-connectors

public void addFileToRequest(String fieldName, File file) throws IOException {

  InputStream inputStream = null;
  try {
    String contentType;
    
    inputStream = new FileInputStream(file);
    contentType = HttpURLConnection.guessContentTypeFromStream(inputStream);
    inputStream.close();
    
    addFileToRequest(fieldName, file, contentType);
    
  } finally {
    if (inputStream != null) {
      inputStream.close();
    }
    
  }
  
}

代码示例来源:origin: org.wso2.esb.integration/integration-base

public void addFileToRequest(String fieldName, File file) throws IOException {
  InputStream inputStream = null;
  try {
    String contentType;
    inputStream = new FileInputStream(file);
    contentType = HttpURLConnection.guessContentTypeFromStream(inputStream);
    inputStream.close();
    addFileToRequest(fieldName, file, contentType);
  } finally {
    if (inputStream != null) {
      inputStream.close();
    }
  }
}

代码示例来源:origin: org.wso2.esb.integration/integration-base

public void addFileToRequest(String fieldName, String fileName) throws IOException {
  File file = null;
  InputStream inputStream = null;
  try {
    fileName = pathToResourcesDirectory + fileName;
    file = new File(fileName);
    String contentType;
    inputStream = new FileInputStream(file);
    contentType = HttpURLConnection.guessContentTypeFromStream(inputStream);
    inputStream.close();
    addFileToRequest(fieldName, file, contentType);
  } finally {
    if (inputStream != null) {
      inputStream.close();
    }
  }
}

代码示例来源:origin: wso2-attic/esb-connectors

public void addFileToRequest(String fieldName, String fileName) throws IOException {

  File file = null;
  
  InputStream inputStream = null;
  try {
    
    fileName = pathToResourcesDirectory + fileName;
    
    file = new File(fileName);
    String contentType;
    
    inputStream = new FileInputStream(file);
    contentType = HttpURLConnection.guessContentTypeFromStream(inputStream);
    inputStream.close();
    
    addFileToRequest(fieldName, file, contentType);
    
  } finally {
    if (inputStream != null) {
      inputStream.close();
    }
    
  }
}

代码示例来源:origin: org.n52.security/52n-security-gatekeeper

if (response_mime == null)
  response_mime = HttpURLConnection
      .guessContentTypeFromStream(ogcInputStream);
if (response_mime == null)
  response_mime = "";

相关文章

HttpURLConnection类方法