Can we pass a Url path and a file name to FileOutputStream in java -


sir new in java want write file on url path there possible way write file on url path give me tips

no can not pass url path , filename both parameter fileoutputstream.

however can write a file reading specified url using below code:

 try{                 url url = new url("http://docs.oracle.com/javase/7/docs/api/java/io/fileoutputstream.html");             string path = "d://stackoverflow/";             inputstream ins = url.openstream();             outputstream ous = new fileoutputstream(path);             final byte[] b = new byte[2048];             int length;                  while ((length = ins.read(b)) != -1) {                        ous.write(b, 0, length);                  }                     ins.close();                    ous.close();         } catch(exception e){             e.printstacktrace();         } 

and please explain trying achieve passing url , filename fileoutputstream?


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -