Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialization

 
rahul arno
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how can i copy the text data of xyz.html page to abc.txt page???
any one help me???
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Guillaume Jourdan
Ranch Hand
Posts: 47
Eclipse IDE Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 47
Eclipse IDE Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JSoup => http://jsoup.org/
 
Guillaume Jourdan
Ranch Hand
Posts: 47
Eclipse IDE Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9494
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic