【httpclient】Attempted read from closed stream

原因是调用了多次,只能调用一次

EntityUtils.toString(HttpEntity)

java.io.IOException: Attempted read from closed stream.
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:172)
	at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:138)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
	at java.io.InputStreamReader.read(InputStreamReader.java:167)
	at java.io.Reader.read(Reader.java:123)
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:233)
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:273)
	at httpclient.TestHttps.main(TestHttps.java:42)


你可能感兴趣的:(httpclient)