Text Or Binary
Hi everyone,
I do not actually have web page i can test this with but would really appreciate anyone with experience on this topic.
You see i am trying to upload a html page called wt.html from my disk to a website called http://www.rt.com/rf/wt.html using the HttpUrlConnection by first authenticating myself into the server getting its outputstream and getting rady to transfer the data.
Here is where my program begins, when a html file is involved do i transfer the data in text form by reading the html tags one by one from the html file on my disk and transferring the html tags one by one using the PrintStream class
Or
can i just use the FileInputStream class to transfer the file from my disk to the server.
For zip files and other data format, i know that i can use the FileInputStream
and do this but for html i am not really that sure and hope that someone can shed some light on this topic for me or anyone that has experience in this arena as i do not actually have a webpage to test this problem with
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
I would go ahead and use the FileInputStream, I just think it'll be easier.
Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
FileInputStream is readonly, FileOutputStream is writeonly...
And those won't cover a scenario where you don't have a drivemapping to the remote site, you'll need a network stream wrapped around it as well for the correct protocol.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
Hi everyone,
FileInputStream is readonly, FileOutputStream is writeonly
Yes sorry i meant FileOutputStream, it was a typoAnd those won't cover a scenario where you don't have a drivemapping to the remote site, you'll need a network stream wrapped around it as well for the correct protocol.
Assuming that i have already gotten what you mention above all covered, do i need to transfer tags by tags or is the FileoutputStream sufficient.
Hoping to hear from you
Yours Sincerely
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
You will need a ByteArrayOutputStream linked to your FileOutputStream.
That you can link to the network port and dump the content of the file as a stream, the content of the file is then completely irrelevant.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337