javax.net.ssl.HttpsURLConnection.setChunkedStreamingMode()方法的使用及代码示例

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

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

HttpsURLConnection.setChunkedStreamingMode介绍

暂无

代码示例

代码示例来源:origin: yavijava/yavijava-samples

conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setChunkedStreamingMode(CHUCK_LEN);
conn.setRequestMethod(put? "PUT" : "POST"); // Use a post method to write the file.
conn.setRequestProperty("Connection", "Keep-Alive");

代码示例来源:origin: com.vmware/vijava

conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setChunkedStreamingMode(CHUCK_LEN);
conn.setRequestMethod(put? "PUT" : "POST"); // Use a post method to write the file.
conn.setRequestProperty("Connection", "Keep-Alive");

代码示例来源:origin: lkuza2/java-speech-api

httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setChunkedStreamingMode(0); //TransferType: chunked
httpConn.setRequestProperty("Content-Type", "audio/x-flac; rate=" + sampleRate);

代码示例来源:origin: yavijava/yavijava-samples

long fileLen = new File(localFilePath).length();
System.out.println("File size is: " + fileLen);
conn.setChunkedStreamingMode((int) fileLen);
OutputStream out = conn.getOutputStream();
InputStream in = new BufferedInputStream(new FileInputStream(localFilePath));

代码示例来源:origin: lkuza2/java-speech-api

/**
 * @param sampleRate
 * @param url
 * @return
 * @throws IOException
 */
private HttpsURLConnection getHttpsURLConnection(int sampleRate, URL url) throws IOException {
  URLConnection urlConn = url.openConnection();
  if (!(urlConn instanceof HttpsURLConnection)) {
    throw new IOException ("URL is not an Https URL");
  }
  HttpsURLConnection httpConn = (HttpsURLConnection)urlConn;
  httpConn.setAllowUserInteraction(false);
  httpConn.setInstanceFollowRedirects(true);
  httpConn.setRequestMethod("POST");
  httpConn.setDoOutput(true);
  httpConn.setChunkedStreamingMode(0);
  httpConn.setRequestProperty("Transfer-Encoding", "chunked");
  httpConn.setRequestProperty("Content-Type", "audio/x-flac; rate=" + sampleRate);
  // also worked with ("Content-Type", "audio/amr; rate=8000");
  httpConn.connect();
  return httpConn;
}

相关文章

HttpsURLConnection类方法