How can I limit bandwidth in Java?

后端 未结 4 1277
情深已故
情深已故 2020-12-01 13:19

I wrote a Java scheduler, every hour using:

new SAXBuilder().build(new URL(xxx));

or

HttpConnection.connect(new URL(xxx));         


        
4条回答
  •  清歌不尽
    2020-12-01 13:46

    Take a look at this thread: http://httpcomponents.10934.n7.nabble.com/throttlling-download-traffic-td18329.html

    Also, if you use apache httpclient you can configure it to use gzip compression and save a bit of bandwidth. Particularly with xml, you should expect a lot less bytes transferred this way.

提交回复
热议问题