Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL myURL = new URL("http://example.com/my/path");
- URLConnection conn = myURL.openConnection();
- conn.setDoOutput(true);
- conn.setDoInput(true);
- OutputStream os = conn.getOutputStream();
- os.write("Hi there!");
- os.close();
- InputStream is = conn.getInputStream();
- // read stuff here
- URL myURL = new URL("http://example.com/my/path");
- URLConnection conn = myURL.openConnection();
- conn.setDoOutput(false);
- conn.setDoInput(true);
- InputStream is = conn.getInputStream();
- // read stuff here
Add Comment
Please, Sign In to add comment