开发者

Files downloading

开发者 https://www.devze.com 2023-01-28 17:12 出处:网络
How do I go about connecting to a server and check if there is a file to be downloaded using Java ME?

How do I go about connecting to a server and check if there is a file to be downloaded using Java ME?

Should I use POST method, post all my required data to server and see what the server response back? And also what are the headers do I have to post together wit开发者_如何学运维h my data?

Or do I have to use a Get method?


You don't need it to do by hand. Just use

HttpConnection connection = Connector.open(url);
DataInputStream stream = connection.openDataInputStream();
while(stream.read() != -1) {
    //your stuff if anything there
}
0

精彩评论

暂无评论...
验证码 换一张
取 消