Java file write url


















Improve Article. Save Article. Like Article. Attention reader! Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. Next Java. URI class in Java. Recommended Articles. Article Contributed By :.

Easy Normal Medium Hard Expert. This should be a comment as it does not answer the question directly. Nevertheless, a great advise : — Ranhiru Jude Cooray. Sure, but at the time of writing I wasn't yet allowed to write comments. Next time, I'll do it right; I'm pretty new here. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. The URLEncoder class methods encode the characters. Next, the program creates the URL object, and sets the connection so that it can write to it:. The program then creates an output stream on the connection and opens an OutputStreamWriter on it:.

If the URL does support output, then this method returns an output stream that is connected to the input stream of the URL on the server side — the client's output is the server's input. This code writes to the output stream using the write method. So you can see that writing data to a URL is as easy as writing data to a stream. The data written to the output stream on the client side is the input for the servlet on the server side. The servlet reads the information you write, performs a reverse operation on the string value, and then sends this back to you.

You now need to read the string the server has sent back. The Reverse program does it like this:. All rights reserved. Hide TOC.



0コメント

  • 1000 / 1000