| Author |
serialization
|
rahul arno
Greenhorn
Joined: Jul 02, 2011
Posts: 6
|
|
how can i copy the text data of xyz.html page to abc.txt page???
any one help me???
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8208
|
|
I'm not sure what you are asking and how it's related to serialization (the title of your thread). .txt and .html files aren't the same - of course they have textual content but HTML has a specific syntax. What exactly are you trying to do?
|
[My Blog] [JavaRanch Journal]
|
 |
Guillaume Jourdan
Ranch Hand
Joined: Jul 24, 2012
Posts: 47
|
|
Hello,
If this is just a copy : http://www.roseindia.net/java/beginners/copyfile.shtml...
If you want to remove HTML tag : http://www.rgagnon.com/javadetails/java-0424.html
With an HTML parser is very simple :
http://jsoup.org/
|
 |
rahul arno
Greenhorn
Joined: Jul 02, 2011
Posts: 6
|
|
sir actually i want to copy all text data from html file to txt file.
i do not understand how can i read the data of html file.
we normally save text data in .txt file using serialization.
so i think its a topic of serialization,if i am wrong you tell me how can i done it??
please help me
|
 |
Guillaume Jourdan
Ranch Hand
Joined: Jul 24, 2012
Posts: 47
|
|
|
Use JSoup => http://jsoup.org/
|
 |
Guillaume Jourdan
Ranch Hand
Joined: Jul 24, 2012
Posts: 47
|
|
And I'm agree with Jaikiran. Your topic is not a serialization topic. It's a topic on HTML parser.
If you want to discover java concept of serialization : http://java.sun.com/developer/technicalArticles/Programming/serialization/
|
 |
Winston Gutkowski
Bartender
Joined: Mar 17, 2011
Posts: 4901
|
|
rahul arno wrote:we normally save text data in .txt file using serialization.
You do? Seems like a mighty odd way to do it to me.
If you literallly just want to copy the contents of the file blindly, then:
1. If you're on Java v6 or earlier, just open a FileInputStream and FileOutputStream to the relevant names and loop through the contents with read() and write(). There may even be slicker solutions available.
2. If you're on Java v7, use Files.copy().
But I suspect that Guillaume is right, and that you actually have something different in mind; but until you tell us what that is, it's difficult to advise.
Winston
|
Isn't it funny how there's always time and money enough to do it WRONG?
|
 |
 |
|
|
subject: serialization
|
|
|