aspose file tools*
The moose likes I/O and Streams and the fly likes wav file serialization? 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 "wav file serialization?" Watch "wav file serialization?" New topic
Author

wav file serialization?

Trelan Hylton
Greenhorn

Joined: Apr 15, 2003
Posts: 27
should i serialize a wav file before using it reading it. if so how do i do that.
i have a file in the directory that is in wav format and i want to read it into my program. what file stream do i use?
i have tried this code so far : 2 classes.
import java.io.*;
import java.util.*;

class Tester implements Serializable{
Object myFile;
public Tester getTest()
{
return (Tester)myFile;
}
public void setTest(Object myFile)
{
this.myFile = myFile;
}

}
and the one that reads the object

import java.io.*;
import java.util.*;

public class ObjectFromDisk{
public static void main(String []arg)
{
try{
FileInputStream fi = new FileInputStream("connect.wav");
ObjectInputStream oi = new ObjectInputStream(fi);
Tester tes = (Tester) oi.readObject();
System.out.println("I hope this works");
oi.close();
}catch(Exception e){System.out.println("Error -- " + e.toString());
}
}
}

i keep getting this error however :
java.io.StreamCorruptedException : invalid stream header.


JH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wav file serialization?