本文整理了Java中java.net.URLConnection.getReadTimeout()
方法的一些代码示例,展示了URLConnection.getReadTimeout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLConnection.getReadTimeout()
方法的具体详情如下:
包路径:java.net.URLConnection
类名称:URLConnection
方法名:getReadTimeout
[英]Returns the read timeout in milliseconds, or 0 if reads never timeout.
[中]以毫秒为单位返回读取超时,如果读取从不超时,则返回0。
代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot-warurl
@Override
public int getReadTimeout()
{
return _conn.getReadTimeout();
}
代码示例来源:origin: freeplane/freeplane
public int getReadTimeout() {
return connection.getReadTimeout();
}
代码示例来源:origin: stackoverflow.com
final URLConnection connection = new URL("http://www.aol.com").openConnection();
System.out.println(connection.getReadTimeout());
final Scanner scanner = new Scanner(connection.getInputStream());
while(scanner.hasNextLine()) System.out.println(scanner.nextLine());
scanner.close();
代码示例来源:origin: stackoverflow.com
socket.setSoTimeout(getReadTimeout());
socket.connect(new InetSocketAddress(proxyHost, proxyPort), getConnectTimeout());
StringBuilder msg = new StringBuilder();
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
@Test
public void testTimeout() throws IOException {
Configuration conf = new Configuration();
URI uri = URI.create("hftp://localhost");
HftpFileSystem fs = (HftpFileSystem) FileSystem.get(uri, conf);
URLConnection conn = fs.connectionFactory.openConnection(new URL(
"http://localhost"));
assertEquals(URLConnectionFactory.DEFAULT_SOCKET_TIMEOUT,
conn.getConnectTimeout());
assertEquals(URLConnectionFactory.DEFAULT_SOCKET_TIMEOUT,
conn.getReadTimeout());
}
代码示例来源:origin: Countly/countly-sdk-android
public void testUrlConnectionForEventData() throws IOException {
final String eventData = "blahblahblah";
final URLConnection urlConnection = connectionProcessor.urlConnectionForEventData(eventData);
assertEquals(30000, urlConnection.getConnectTimeout());
assertEquals(30000, urlConnection.getReadTimeout());
assertFalse(urlConnection.getUseCaches());
assertTrue(urlConnection.getDoInput());
assertFalse(urlConnection.getDoOutput());
assertEquals(new URL(connectionProcessor.getServerURL() + "/i?" + eventData + "&checksum=" + sha1Hash(eventData + null)), urlConnection.getURL());
}
内容来源于网络,如有侵权,请联系作者删除!