• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to save a file in default format  RSS feed

 
pradipta kumar rout
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,

I want to store a file from URL and it should be in the default format

example:

suppose i want to save the content of URL=http://www.youtube.com

my objectives is to

1.I want to save the file in the default format it have ,
2.I don't know what the file format but it should save in that .
3.Suppose a Url contain xyz format then it should save in . that format in a .txt file.
4.I want to save this in this format.

I know how to save a file from URL using URL class and writer Classes but do not know how to save in the default format ,

I have tried and the content of http://www.youtube.com is UNICODE but it is stored in ANSI format so how to save it in that .


So kindly tell me a suggestion....
I am doing my project it will very helpful for me
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get the filename of the resource and write out the contents into a new file with this filename. Normally the filename will have some indication as to the format of the file. For example, Letter.txt will be a text file, so writing it out as a Letter.txt will also be a text file. Prefer writing in binary mode only, so that you do not corrupt contents accidentally.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't look at the filetype. For instance an website page with the name content.php will almost never return php code but rather an html file. You could look at the mime type that is returned by the server.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!