This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Junk value when converting .doc t .txt file  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Junk value when converting .doc t .txt file  " Watch "Junk value when converting .doc t .txt file  " New topic

Junk value when converting .doc t .txt file

anu shree

Joined: Apr 22, 2008
Posts: 2
class try2
public static void main(String[] args)

{ file = new File("C:/read1.doc");
FileInputStream fis = new FileInputStream(file);
byte bytes[] = new byte[fis.available()];;
System.out.println("Hello World! "+bytes.length);

FileOutputStream fis1=new FileOutputStream("C:/read2.txt");
catch(Exception e)

i am converting doc file to txt file.The file is getting created.The value which i am redaing junk
Can Any one Help me Please
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
This code isn't converting anything. It's reading a file, and storing it with a different extension.

It's rather hard to read -and make sense- of DOC files. If all you want to do is extract text from DOC files, then the Apache POI library can do that.

Alternatively, OpenOffice has a Java API that you can use; the JODConverter library makes it easier to use that to convert between file formats.
I agree. Here's the link:
subject: Junk value when converting .doc t .txt file
It's not a secret anymore!